When adding a RecyclerView as a child/grand-child to the MotionLayout, the Motion-Layout cannot progress across transitions.
eddardsnarf opened this issue · comments
Context:
I'm using a modified version of the fragment-transition example, in which we have a MotionLayout
containing the TouchFrameLayout
. Inside of it I've replaced the fragments in the example with the ListFragment.
Afterwards I've modified the main_scene.xml to have multiple transitions like:
MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto"
android:id="@+id/motionLayout">
<Transition
android:id="@+id/transition_start_mid"
motion:constraintSetEnd="@id/mid"
motion:constraintSetStart="@id/start"
motion:duration="500"
motion:motionInterpolator="linear" >
<OnSwipe
motion:touchAnchorId="@id/container"
motion:touchAnchorSide="top"
motion:onTouchUp="decelerateAndComplete"
motion:dragDirection="dragUp"
/>
</Transition>
<Transition
android:id="@+id/transition_mid_end"
motion:constraintSetEnd="@id/end"
motion:constraintSetStart="@id/mid"
motion:duration="500"
motion:motionInterpolator="linear" >
<OnSwipe
motion:touchAnchorId="@id/container"
motion:touchAnchorSide="top"
motion:onTouchUp="decelerateAndComplete"
motion:dragDirection="dragUp"/>
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@id/main"
android:layout_width="0dp"
android:layout_height="100dp"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintBottom_toBottomOf="parent">
<CustomAttribute
motion:attributeName="BackgroundColor"
motion:customColorValue="@color/colorPrimary" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/mid">
<Constraint
android:id="@id/container"
android:layout_width="0dp"
android:layout_height="400dp"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintBottom_toBottomOf="parent">
<CustomAttribute
motion:attributeName="BackgroundColor"
motion:customColorValue="@color/colorPrimary" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@id/container"
android:layout_width="0dp"
android:layout_height="0dp"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
motion:layout_constraintBottom_toBottomOf="parent">
<CustomAttribute
motion:attributeName="BackgroundColor"
motion:customColorValue="@color/colorAccent" />
</Constraint>
</ConstraintSet>
</MotionScene>
The issue is that if the user tries to scroll the "bottom-sheet" up and down by using the recycler-view, the motionlayout won't progress from one transition to another. Thus making the whole interaction a bit unintuitive.
Is there some way to tell the MotionLayout to use the nested scrolling to progress across transitions?
I'll attach a video of my tests (Please ignore the sticky navy blue view at the bottom.).