How to put horizontal recirculation inside vertical scroll
I am trying to fit six horizontal rows of recyclerview inside a vertical scroll. What I have is a top row of reusable buttons that allow me to select a date followed by six horizontal views that allow me to select items, and then a bottom row of three buttons
The code for my non-scrollable snippet looks like this:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="db.cbm.com.myapp.MenuPickerFragment">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:text="@string/pick_menu" />
<LinearLayout
android:id="@+id/datePickerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/day_of_week_list"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:orientation="vertical">
<LinearLayout
android:id="@+id/breakfastScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/breakfastList"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/snack1ScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/snack1List"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/lunchScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/lunchList"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/snack2ScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/snack2List"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/dinnerLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/dinnerList"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/snack3ScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/snack3List"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/button4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/cancel" />
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/save" />
<Button
android:id="@+id/button6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/done" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
The above works correctly except the images in the six menu picker recycler view rows are too small so I would like to increase their size and put them into a vertical scroll view.
Here what I think I want but it doesn't work, none of my recyclerviews are present or at least they're not initialized and I don't see any rows. Any idea what I'm doing wrong?
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="db.cbm.com.myApp.MenuPickerFragment">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:text="@string/pick_menu" />
<LinearLayout
android:id="@+id/datePickerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/day_of_week_list"
android:layout_width="wrap_content"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/breakfastScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/breakfastList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/snack1ScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/snack1List"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/lunchScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/lunchList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/snack2ScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/snack2List"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/dinnerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/dinnerList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/snack3ScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/snack3List"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/button4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/cancel" />
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/save" />
<Button
android:id="@+id/button6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/done" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
Any help is greatly appreciated, thanks!
+3
source to share
No one has answered this question yet
See similar questions:
or similar: