0

To show list of books in an Android App, I need an expandable RecyclerView, having "some" items expandable and some not, please check attachment.

I checked these libraries :

https://github.com/thoughtbot/expandable-recycler-view

https://github.com/bignerdranch/expandable-recycler-view

I need a library to do this, but all of available libraries I found have all items expandable, not some of them.

enter image description here

AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
  • Can you tell, what approach you have taken for Expandable RecyclerView ? Or you have used any library ? – Milind Mevada Feb 22 '18 at 05:05
  • what is the problem you are facing ?? please explain. you want a library or you want to know the logic? – Sagar Nayak Feb 22 '18 at 05:05
  • `ExpandableRecyclerView` is not provided in APIs . If you are using a library then you have to modify it in this way or maybe it comes with such behavior . Do you want to block expand if header view contains childs ? – ADM Feb 22 '18 at 05:07
  • Yes I need a library, sorry for insufficient description! – AVEbrahimi Feb 22 '18 at 05:07
  • try this :https://www.bignerdranch.com/blog/expand-a-recyclerview-in-four-steps/ – Vidhi Dave Feb 22 '18 at 05:13
  • Possible duplicate of [RecyclerView expand/collapse items](https://stackoverflow.com/questions/27203817/recyclerview-expand-collapse-items) – Vidhi Dave Feb 22 '18 at 05:15
  • try this ans :https://stackoverflow.com/a/38623873/8089770 – Vidhi Dave Feb 22 '18 at 05:15

1 Answers1

0

You can add onClickListener to the group item layout. In onClick just check if items need to be expanded. then expand the list. Otherwise not.

And another point, if your child list is empty, then it should not be expanded.It will happen automatically.

Rasel
  • 15,499
  • 6
  • 40
  • 50