简体   繁体   中英

Recycler view in a recycler view

I am looking for solution that solves a problem of a dynamic list that in turn contains a dynamic list of rows.

I have a recycler view which holds a card view that eventually holds another recyclerview. I can see that the parent recycler view is showing up but the child recycler is not showing up. {{recyclerView{cardView{recyclerView}}} The getItemCount method is being called but all the other methods such as onCreateViewHolder and bind are not being called.

I have made sure both the recycler views have the linearlayoutmanager implemented and have setFixedSize as true.

I believe it is the issue with your xml layout. Maybe it is not coming in focus hence it is not calling those overridden methods,as recylerview becomes unavailable.Make sure that the padding,height and rest other things are such that the child recyclerview is visible.Actually when I implemented it, I faced the same issue and the reason was my xml layout with the same reason as my second recyler was not visible due to overpadding and margin.

Found the problem. Had to upgrade to a newer version of recycler view. And added wrap content. It started working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM