android - Recyclerview binds all views at the same time -


i have vertical recyclerview (with gridlayoutmanager) inside recyclerview (with linearlayoutmanager). problem facing right that, inner recyclerview (with gridlayoutmanager) binds of it's items @ same time, views not on screen @ moment (onbindviewholder() gets called of items).

to give more information, in layout file, put height of recycler view wrap_content.

i think problem is, since there 2 nested vertically recyclerviews, when parent rv wants measure children , children rv, in onmeasure() computes size needed entire rv, not portion wants bind on screen.

any idea how solve this?

here layout file outer recyclerview:

<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">  <android.support.v7.widget.recyclerview     android:id="@+id/component_list"     android:layout_width="match_parent"     android:layout_height="match_parent"/>  </framelayout> 

and here code inner recyclerview:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="@dimen/gutter" android:paddingbottom="@dimen/gutter">  <textview     android:id="@+id/title_text"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_marginbottom="@dimen/gutter"     android:textsize="30sp"     android:textcolor="@android:color/white"     android:fontfamily="sans-serif-thin"/>  <android.support.v7.widget.recyclerview     android:id="@+id/my_slider"     android:layout_width="match_parent"     android:layout_height="wrap_content"/>  </linearlayout> 

p.s.: i'm using adapter delegate outer recyclerview: https://github.com/sockeqwe/adapterdelegates

i think nested recyclerviews bad idea. when try scroll, recyclerview has respond the scolling, parrent or child.

that why think looking expandablelistview? that's limited 2 levels of listings, sounds work needs). solves soling issue.

it this:

enter image description here

edit: nested expandablelistviews possible:

enter image description here

edit: check this lib horizontal scroling


Comments