There is a RecyclerView with CardView , the data in which is loaded from the database. How to make a horizontal scrolling list in CardView with regular text elements (which are also from the database)?

I consider doing another RecyclerView inside CardView inside RecyclerView too complicated.

  • one
    In the horizontal RecyclerView inside the vertical (or vice versa) there is nothing wrong. That is how it is implemented in Google Play. Now, if the nested scrolling elements in one direction, here something has already gone wrong. - eugeneek
  • I read somewhere that Google does not recommend using this option. Apparently exactly as you said, with the same scrolls. It just looks a bit cumbersome (for each recycler its own adapter). - Anton Popkov

2 answers 2

Everything is very dependent on your situation, if you have several text elements there, in which there is some text, then the game is not worth the trouble, but if you suddenly have a lot of text elements inside each CardView, then the RecyclerView thing will save you from problems with the simultaneous use of a huge count of View, as is the case with ScrollView, as there is reuse. Another option is that you should only display one text element at a time, then you should use the ViewPager inside CardView

  • Yes, there can be unlimited items. Means all the same RecyclerView. - Anton Popkov

You can use HorizontalScrollView . The structure of a single CardView element should be something like this:

 <CardView ... <HorizontalScrollView ... <LinearLayout android:orientation="horizontal" .... <TextView ... /> <TextView ... /> </LinearLayout> </HorizontalScrollView> </CardView>