#StackBounty: #android #android-motionlayout Parent height is 0 while child view height > 0

Bounty: 50

I have a layout with a FrameLayout, in FrameLayout, there is 2 RelativeLayout. I include this layout to activity_main.xml by include tag.
activity_main.xml is a MotionLayout and this "include layout" is a child of MotionLayout.
I have define a ConstraintSet, inside this ConstraintSet, I have define Constraint for this "include layout" (width=match_parent, height=wrap_content, bottomToBottomOfParent).

In the code, I show/hide above RelativeLayout by condition then I use transitionToState to transition to above ConstraintSet. Most of time, it work well but sometime the above "include layout" is not displayed.

I put debug (with delay 2 second to make sure the view fully render) and I found that when "include layout" is not displayed, it’s height is 0 but the child view height is > 0

parentView.layoutParams.height=-2, -2 <=> WRAP_CONTENT

Is there any possible case which can cause this issue happened?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.