1

I have a question because of the recyclerview issue.

My recyclerview structure is like the picture below

enter image description here

No. 2 and No. 3 are overlapped with the recycler view. No. 3 inside the recycler view,

Recycler view 3 uses a recycler view that scrolls infinitely. When you first load an item, scrolling is normal, but when you add an item later, the recycler view scrolls slowly and stutters.

I looked at the profiler, but the cpu, memory, etc. are not particularly strange.

If you don't use nested recycler view, scrolling works normally, but you have to use recycler view 3 inside recycler view 2 for modularity

I've googled a lot and looked at various materials, but nothing has changed. If you have a solution, could you please share it with me?

No matter how much I think about it, I think there is an issue where the recycler view is not reused.So I checked with the following code, and the log is showing normally.

private fun setupRecyclerView() { recyclerView.apply { setRecyclerListener { println("=========== View is reused in $it") } } }

From the log, it seems that the viewHolder is reused every time.

Duseop
  • 137
  • 2
  • 11
  • Have you tried with this way ? recyclerView.setNestedScrollingEnabled(false); – Mehul Tank Sep 10 '21 at 07:37
  • Yes I tried that method, but it doesn't work. I am also using setHasFixedSize(true) and after loading the item, scrolling does not work properly, so I adjusted the image size, etc., but the scroll does not work well – Duseop Sep 10 '21 at 07:40
  • In that recycler view, you are loading very high-resolution images? – Mehul Tank Sep 10 '21 at 07:41
  • If the image is a problem, the same phenomenon should occur when using only recycler view 2 without using recycler view 3. but it doesn't happen ,I also tried changing the image size, but the scrolling does not work properly. – Duseop Sep 10 '21 at 07:43
  • Can you help me understand what exactly are you trying to achieve so that we can look for alternative solution, using 3 recyclerview in a same screen doesn't seems to be a good approach – Nitish Sep 10 '21 at 08:08
  • nitish chaudhary // To be precise, it uses two recycler views. 1 is the layout – Duseop Sep 10 '21 at 08:27
  • 1
    in your xml you used many nested layout if used that nested widget which was unnecessary then you have to remove it – Mehul Tank Sep 10 '21 at 08:33
  • It's a nested recycler view, but if you use only one recycler view, isn't it a nested recycler view? ... – Duseop Sep 10 '21 at 08:45
  • To extend what Mehul Tank wrote. Having a lot of nested LinearLayouts can impact performce. Replace LinearLayout with ConstraintLayout to simplify view hierarchy. Talking from personal experience. – David Vareka Sep 10 '21 at 11:43
  • try adding `app:layout_behavior="@string/appbar_scrolling_view_behavior"` attribute to reccyclerview – Dnyaneshwar Patil Sep 12 '21 at 07:41
  • This answer may be helpful. https://stackoverflow.com/questions/59973757/nested-recyclerview-not-scrolling or https://stackoverflow.com/a/32664619/12347940 – Dnyaneshwar Patil Sep 12 '21 at 07:42
  • Dnyaneshwar Patil // This article has absolutely nothing to do with my problem. – Duseop Sep 13 '21 at 01:24

0 Answers0