animateLayoutChanges="true" in BottomSheetView showing unexpected behaviour : <p>I have a <code>BottomSheetView</code> which has <code>animateLayoutChanges="true"</code>. Initially it shows up fine. But if change the <code>visibility</code> of a view (inside <code>BottomSheetView</code>) from <code>GONE</code> to <code>VISIBLE</code>, the app messes up calculations and my <code>BottomSheetView</code> moves to the top of the screen. i have tried setting <code>layout_gravity=bottom</code> at the root of the <code>BottomSheetView</code> layout. But no success. </p>

<p>Here I have the image of my <code>BottomSheetView</code> before changing the visibility of any view. (Click image for full size)</p>

<p><a href="https://i.stack.imgur.com/K4vGv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/K4vGvm.png" alt="enter image description here"></a></p>

<p>After I change the visibility of a view (<code>GONE</code> to <code>VISIBLE</code> or <code>VISIBLE</code> to <code>GONE</code>), my BottomSheetView moves to the top. (Click image for full size)</p>

<p><a href="https://i.stack.imgur.com/eV4mf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eV4mfm.png" alt="enter image description here"></a></p>

<p>I guess, Android is messing up while making calculations about the measurement of view <code>width</code> and <code>height</code>. Any way to solve this??</p>

<p>I also tried to make my BottomSheetView extend fully to match the parent view, but somehow that is making the <code>height</code> of the <code>BottomSheetView</code> longer than the phone screen and in-tun creating scrolling issues. </p>

<p><strong>Expected solutions:</strong></p>

<p>1> Prevent <code>BottomSheetView</code> from changing its position even when the <code>visibility</code> of a view is changed. </p>

<p>OR</p>

<p>2>Make the <code>BottomSheetView</code> match parent so that it does not look bad after messing up with the calculations. </p>
