android / views-widgets-samples

Multiple samples showing the best practices in views-widgets on Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MotionLayout inside a ScrollView not optimized for animation changes

abbasshah17 opened this issue · comments

Hi, I have a MotionLayout inside a ScrollView where I'm hiding and showing Views during the Transition from one ConstraintSet to the next.

I'm having a couple of problems when I ad a ScrollView as a parent:

  • Animation between any two ConstraintSets skips all the frames except the end.
  • Transitions between some ConstraintSets doesn't yield the same result as without (I realize this might be because of incomplete/wrong ConstraintSets defined in the scene, however I've searched through the code and can't find any reasonable explanation).

I can further provide a complete example for the 1st case if needed. However the problem is fairly consistent.

At first I thought the problem was due to size/bounds re-calculations of MotionLayout (due to the newly added parent) which was changed from "android:layout_height="match_parent" to "android:layout_height="wrap_content" and so I reset the height to a hard-coded value to see if that would optimize the drawing. But that did not yield any difference.

I also tried motion:layoutDuringTransition="ignoreRequest" on all the transitions but again no good result.