2

I have a RecyclerView nested in a vertical scrolling view. The RecyclerView displays items with a vertical LinearLayoutManager. Its height is (and has to be, per product specification) set to wrap_content.

Problem is memory and performance issues come around quickly when I set a large amount (~50+) because items are simply not recycled.

What is the good way to make this work nicely and smoothly?

Edit: Ok, some more details.

I have to make screen that describes a TV show: the synopsis, the list of seasons, and for each season the list of episodes. The list of episodes for each season must not be collapsed/folded/shrinked.

This is what I have to achieve:

enter image description here

riot
  • 417
  • 4
  • 15
  • RecyclerView never loaded for 50+ items at one time. They use the minimum amount of views that need to be loaded when user scrolling. (threadhold) – phatnhse Aug 11 '17 at 16:26
  • @PhátPhát the height of the RecyclerView is not limited, so it is as big as there are items, and so it will load all items at once. – riot Aug 11 '17 at 17:05
  • You need to read documentation again https://guides.codepath.com/android/Endless-Scrolling-with-AdapterViews-and-RecyclerView – phatnhse Aug 11 '17 at 17:07
  • You say it's height "has to be, per product specification" `wrap_content`. Can you elaborate? I'd be very surprised if a customer asked for specific xml attribute values. Maybe you could explain the overall UI you are trying to achieve? – Ben P. Aug 11 '17 at 17:40
  • Ok, I edited my post with an image. – riot Aug 12 '17 at 12:17
  • 1
    @riot Found any solution? I'm dealing with the same kind of problem now. RecyclerView loads all items once because of wrap_content and it freezes the UI. – muthuraj Apr 26 '18 at 19:44
  • @muthuraj The solution I found is to use a unique RecyclerView with different row types. In my example the RV will display the "Lorem ipsum..." text as first view, "Season 1" as second view, "Episode" as third view, etc. – riot Apr 27 '18 at 20:53

1 Answers1

0

The problem is, that you have a scrolling view inside a scrolling view. Apply recyclerView.setNestedScrollingEnabled(false) to your RecyclerView.

azizbekian
  • 60,783
  • 13
  • 169
  • 249