0

I have 3 vertical recycler view in a screen inside a NestedScrollView like:

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

            <androidx.recyclerview.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

            <androidx.recyclerview.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

            <androidx.recyclerview.widget.RecyclerView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

    </LinearLayout>
</androidx.core.widget.NestedScrollView>

I need to set recycler-view's height wrap_content because the contents are dynamic. When I'm calling submitList(...), the 60-80 frames skipped. Child views are cheap and simple and the total items for showing in all of them are about 30.

When I hardcoded the recycler-view's height for example 100dp there's no skipped frame in the result!

How can I fix this issue or improve this function?

P.S: I can't merge them together by an adapter with multiple view-type.

beigirad
  • 4,986
  • 2
  • 29
  • 52
  • 1
    If your recyclerViewItems have static size then you can use `setHasFixedSize()` on recyclerViews. i can't say this method solve your problem but it can imporove your performance. – Mehdi Yari Jun 09 '20 at 13:18
  • Ok, why do you have 3 RecyclerViews in a NestedScrollVIew? What are you trying to achieve here? To begin with, a RecyclerView won't recycle anything when in a ScrollView... – Nicolas Jun 09 '20 at 23:46

0 Answers0