Android MotionLayout未平滑设置动画

Android MotionLayout未平滑设置动画,android,android-motionlayout,Android,Android Motionlayout,我有一个片段,它的布局由一个MotionLayout组成,它有两个子元素。一个子元素是水平RecyclerView,另一个子元素是FrameLayout。它们是垂直堆放的 MotionLayout --RecyclerView (horizontal) --FrameLayout 在FrameLayout中有一个ViewPager——每个页面都是一个片段,带有一个垂直的回收视图。我希望此垂直RecyclerView的滚动可以像折叠工具栏布局一样,在水平RecyclerView上折叠/展开Fra

我有一个
片段
,它的布局由一个
MotionLayout
组成,它有两个子元素。一个子元素是水平
RecyclerView
,另一个子元素是
FrameLayout
。它们是垂直堆放的

MotionLayout
--RecyclerView (horizontal)
--FrameLayout
FrameLayout
中有一个
ViewPager
——每个页面都是一个
片段
,带有一个垂直的
回收视图
。我希望此垂直
RecyclerView
的滚动可以像
折叠工具栏布局一样,在水平
RecyclerView
上折叠/展开
FrameLayout

使用以下场景很容易实现“工作”:

<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <Transition
        app:constraintSetEnd="@+id/collapsed"
        app:constraintSetStart="@+id/expanded">

        <OnSwipe
            app:dragDirection="dragDown"
            app:onTouchUp="autoComplete"
            app:touchAnchorId="@+id/vertical_recycler_view"
            app:touchAnchorSide="top" />

    </Transition>

    <ConstraintSet android:id="@+id/expanded">

        <Constraint
            android:id="@id/my_framelayout"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/horizontal_recycler_view" />

    </ConstraintSet>

    <ConstraintSet android:id="@+id/collapsed">

        <Constraint
            android:id="@id/my_framelayout"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </ConstraintSet>

</MotionScene>

这“有效”。
FrameLayout
按预期在水平
RecyclerView
上“折叠”

我的问题是动画不会顺利发生(随着时间的推移)。
FrameLayout
会立即折叠/展开捕捉

谁能告诉我我做错了什么


谢谢

尝试将
app:touchcorside
更改为底部

折叠/展开的
快照是
app:onTouchUp=“autoComplete”
的预期行为

如果您希望折叠动画跟随您的滚动,请尝试将
app:onTouchUp=“autoComplete”
更改为
app:onTouchUp=“stop”