RecyclerView inside NestedScrollView scroll faster, but when we remove NestedScrollView RecyclerView is not working smoothly, it stuck while scrolling and after full loaded, no problem in scrolling,it take some time to load data when it is inside RecyclerView without NestedScrollView
No issue if it is inside NestedScrollView but because of some issue we need to remove NestedScrollView .
How to solve this issue?
Asked
Active
Viewed 336 times
4

Midhilaj
- 4,905
- 9
- 45
- 88
-
I would not suggest using recyclerview inside NestedScrollView, as it will loose its recycling logic and will not recycle its views. When you load many items it becomes laggy because onMeasue() method is called on each item and its child items as u scroll – MJakhongir Feb 11 '19 at 06:48
1 Answers
4
In your case RecyclerView
inside NestedScrollView
is faster because RecyclerView
haven't height limits and adapter load all items. You have to use correct implementation of ViewHolder
pattern and don't block ui thread to get smoothly scrolling

Stanislav Bondar
- 6,056
- 2
- 34
- 46
-
"You have to use correct implementation of ViewHolder pattern" How please give more details – Midhilaj Feb 07 '19 at 15:07
-
1
-
@Midhilaj try this https://willowtreeapps.com/ideas/android-fundamentals-working-with-the-recyclerview-adapter-and-viewholder-pattern – Stanislav Bondar Feb 07 '19 at 15:31
-
-
In my case we are loadig images and video is there any way to make it work in background thread – Midhilaj Feb 07 '19 at 15:36
-
@Midhilaj: For image correct implementation inside adapter, use Glide library. Adapter arent there for load all data on load, its a bad practice doing that in Android, they recycle views in order to make that process efficent. Stanislav is correct here saying that about data inside RecycleView and NestedScrollView – Catluc Feb 15 '19 at 11:23