I recently updated from support library recyclerview-v7:23.1.1 to recyclerview-v7:25.1.0.
My Layout contains 2 recylerviews splitted 50% on the screen. The xml code is as follows:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:scrollbars="none"/>
<android.support.v4.widget.Space
android:layout_width="@dimen/two_dp"
android:layout_height="match_parent"
android:background="@color/dark_gray"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:scrollbars="none"/>
</LinearLayout>
Now onBindViewHolder is called for all list items instead of only the visible items. This started happening after update to support library 25.1.0.
It is working fine if weights are removed, but having 2 recylcerviews side by side is required.
How do I tell recyclerview to recycle views instead of loading all?
UPDATE: It works fine on Marshmallow and above devices. The issue is present in Lollipop or below. You can find a demo project here: https://bitbucket.org/aniketit/recyclerviewtest