bmelnychuk / AndroidTreeView

AndroidTreeView. TreeView implementation for android
Apache License 2.0
3k stars 620 forks source link

AndroidTreeView expand issue #107

Open yihongyuelan opened 7 years ago

yihongyuelan commented 7 years ago

Thanks for your awesome project, but I found some issue in "Custom Holder Example". If you expand the Social node, it will cause a wrong animation.

cast_new.gif

I found in AndroidTreeView.expand() method:

v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); final int targetHeight = v.getMeasuredHeight();

targetHeight's value is very large. Can you give me some advices?

yihongyuelan commented 7 years ago

Now I just set targetHeight = 0 to avoid this issue.

Morteza561 commented 7 years ago

Same issue here :-(

markowanga commented 7 years ago

Just replace (written in Kotlin) v.measure(MeasureSpec.makeMeasureSpec((v.parent as View).width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((v.parent as View).height, MeasureSpec.AT_MOST))

I used this library but this bug was terrible so I decided to write own expand view - I've got the same problem :) - but this line solves the problem