I'm trying to show horizontal recyclerview items and vertical recyclerview items inside an ScrollView
Scrollview didn't work even If i use android:fillViewport="true"
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
//Horizontal Recyclerview items
<RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RecyclerView>
//vertical Recyclerview items
<RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"></RecyclerView>
</LinearLayout>
</ScrollView>
You should use NestedScrollView instead. However you may need to write your own LayoutManager. Check out this SO Answer for more details
You need to use a custom layout manager to use recyclerview inside a scrollview.
You can remove the scrollview and make a header item in the vertical recyclerview which contain the horizontal recyclerview.
Also you should not use a recyclerview inside a scrollview. So think the second approach will be better.
Also you can can use Snap-RecyclerView-Utils. It has a linear layout manager for recyclerview inside a scroll view and an adapter which can help you make a header containing you horizontal recyclerview.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With