Closed grivos closed 11 years ago
Actually I struggled with this same issue, but for me, getHeight doesnt work properly. The expand animation does not show up anymore. Only the collapse animation works.
The reason this is because when the expandable view is collapsed, its view is reported as 0, so getHeight() will return 0, and thus the animation will animate from 0 to 0, when the animation finishes to item is set to visible.
I added some logging code just after the getHeight in your solution on the /sample project:
Log.d("ExpandCollapseAnimation", "getHeight = " + mEndHeight + " , layoutParams.height = " + mAnimatedView.getLayoutParams().height);
When an item A is expanded, and you try to expand a differnt item B, then there are two animations. Expand animation on item B Collapse animation on item A
For the item B to show (animation fails to work with getHeight):
01-12 01:59:46.718: DEBUG/ExpandCollapseAnimation(15147): getHeight = 0 , layoutParams.height = 150
And for the item A to hide (works properly):
01-12 01:59:46.726: DEBUG/ExpandCollapseAnimation(15147): getHeight = 150 , layoutParams.height = 150
Could you try to get your solution to work with the /sample project. If it works i'm glad to accept it.
Thanks for your input, i think I solved it. Please follow issue #2 for more info on the solution.
Hey, take a look at my last commit a1fac98, tell me what do you think. Thanks!
@grivos I like this commit: https://github.com/grivos/Android-SlideExpandableListView/commit/b89c66b83560987968c5641d58d3955c0e9d00e2 It usese the nice SpareIntArray as i should have done in the first place Could you generate a pull request?
I dont like https://github.com/tjerkw/Android-SlideExpandableListView/commit/a1fac98. In Android event listeners are always interfaces. You shoudnt have to extend an Adapter in order to listen for events.
Actually i think my new ActionSlideExpandableListView which was commited before your changes actually solve your problem.
See how it is used here:
Ok i'm cherry picking only that change.
You are now an official contributor :+1:
Cool! This library can really make an app look much more polished. And I saw your example of listeners to expandable views - you're right, it is a better design.
Ok i'm closing this issue since it is fixed.
@grivos i added you as a contributor to this project. This means you got full write access to the repo.
I'm doing this because in the end i think this is good for this project. You don't have to commit anything, but if you want to, you're free todo so. :-)
Thanks :)
I had troubles with animations on target views with layout height set to wrap_content, these changes helped me out.