Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Expandable Layout in Recycler View #56

Open
droidluv opened this issue Feb 20, 2018 · 7 comments
Open

Using Expandable Layout in Recycler View #56

droidluv opened this issue Feb 20, 2018 · 7 comments

Comments

@droidluv
Copy link

droidluv commented Feb 20, 2018

Sometimes before closing when the view is scrolled out(fling action) and recycled, the expandable layout bugs out with partially opened view with the height expanded only part way, when calling collapse on that the height doesn't reduce but the views inside disappear.

Also the duration is set as 1000ms.

Also sometimes it won't expand at all, also the expandable area is not a small one like in the example, its around 200dp in height.

@Trust-Coder
Copy link

Trust-Coder commented Apr 27, 2018

you need to notify the recyclerview that your data is changed so it will reload the updated views. use notifydatasetchanged with the position of item you changed.

@droidluv
Copy link
Author

Its not a data issue, the layout fails to collapse, it will be frozen, and I'm not talking about data update here, its like mentioned if I started collapse or expand action and suddenly scrolled with especially a fling action the layout will bug out and the viewholder will hold out a bugged out version of the expandable layout which will be partially collapsed or expanded and on click will hide its content after a delay but won't collapse, the only solution is to prevent user from scrolling until the expand or collapse animation has completed to prevent the layout from bugging out when being recycled.

@Trust-Coder
Copy link

Trust-Coder commented Apr 27, 2018 via email

@droidluv
Copy link
Author

I think you're confused with what I am saying, lets make it a bit more clear, if a view holder containing a swipe view layout is getting recycled when its collapsing or expanding (suppose the collapse time is 1 second because the content is large), during that time the swipe view layout has a freeze issue where it will freeze out part way, and nothing, even calling collapse() or expand() makes it animate anymore, but it will hide its content when calling collapse() and make items visible when calling expand() all the time while being partially open.

I am already maintaining saved states to preserve which position(s) needs to be expanded and collapsed

@cachapa
Copy link
Owner

cachapa commented May 2, 2018

@droidluv thanks for the report. I've managed to reproduce the issue (or at least a similar issue) on my side. I'll try to issue a fix as soon as possible.

@pdadmehr
Copy link

pdadmehr commented Jun 19, 2019

@cachapa, Is it possible to use the Recycler view with 3 levels? Parent, Child, and Grand Child where expanding parent will reveal all of its children and expanding each of those children will reveal theirs?

@cachapa
Copy link
Owner

cachapa commented Jun 21, 2019

@pdadmehr honestly I'm not sure. ExpandableLayout wasn't really designed to be nested since it needs to be able to measure its children so it can size itself.

I think it might work but I'd still recommend against it, as I'm afraid performance wouldn't be great. ExpandableLayout requests layout rebuilds on every frame when expanding or contracting, so its children should be as simple as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants