我需要在我的应用程序中实现这一点。最好查看视频示例,因为我无法用文字准确解释:
拖动动作:https : //streamable.com/i0aen
点击动作:https : //streamable.com/7eahj
我能够独立地实现它们。但我不能一起做。我使用的是单个运动场景文件。我可以注释掉一个过渡,而另一个有效,但是如果我离开它们,布局根本不会表现,我猜一个过渡会捕获另一个并停止。有没有办法在同一个视图上实现这两个事件?这是motion_scene的代码:
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<!-- <Transition-->
<!-- android:id="@+id/dragTransition"-->
<!-- motion:constraintSetEnd="@+id/endDrag"-->
<!-- motion:constraintSetStart="@+id/startDrag"-->
<!-- motion:duration="1000">-->
<!-- <OnSwipe-->
<!-- motion:dragDirection="dragDown"-->
<!-- motion:touchAnchorId="@id/menuBtnFrFr"-->
<!-- motion:touchAnchorSide="top" />-->
<!-- </Transition>-->
<Transition
android:id="@+id/clickTransition"
motion:constraintSetEnd="@+id/endClick"
motion:constraintSetStart="@+id/startClick"
motion:duration="300">
<OnClick motion:targetId="@id/menuBtnFrFr" />
</Transition>
<ConstraintSet android:id="@+id/startDrag">
<Constraint
android:id="@+id/menuBtnFrFr"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginLeft="75dp"
android:layout_marginRight="75dp"
android:background="#00000000"
android:src="@drawable/logo"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintDimensionRatio="1:1"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent">
<CustomAttribute
motion:attributeName="Saturation"
motion:customFloatValue="1" />
</Constraint>
<Constraint
android:id="@+id/bgCircleOutside"
android:layout_width="350dp"
android:layout_height="350dp"
android:layout_below="@id/top_label"
android:layout_gravity="center"
android:layout_margin="15dp"
android:background="@drawable/circle_dark"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintDimensionRatio="1:1"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent">
<CustomAttribute
motion:attributeName="Saturation"
motion:customFloatValue="1" /> …Run Code Online (Sandbox Code Playgroud)