I have a FrameLayout which I replace on activity create with fragment where I show and hide some of the views with layout animation change, this works well, but I have a FloatingActionButton anchored to the frame layout and when the layout animates on hiding or showing view the fab flickers, as if there was no animation and those views dissapeared immediately, then goes back and animates with the view.
This really breaks the smoothnes of the whole transition so my question is did anyone else experience this? And is there a fix or workaround for this bug?
This issue still seems to exist in SDK 29 with certain elements, such as those with innate transitions. The way I've fixed it is by applying the below flags to the CoordinatorLayout
ViewGroup after setting the attribute android:animateLayoutChanges="true"
.
cLayout.getLayoutTransition().disableTransitionType(LayoutTransition.APPEARING);
cLayout.getLayoutTransition().disableTransitionType(LayoutTransition.DISAPPEARING);
This way, the transitions are not duplicated for the views that already include them.
Depending on your situation, you may consider disabling the other transition types instead:
LayoutTransition.CHANGE_APPEARING
LayoutTransition.CHANGE_DISAPPEARING
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With