Android 是否可以在不使用ConstraintSetStart的情况下定义运动场景过渡?
我努力创建更通用的运动布局场景。到目前为止,我看到的每个教程示例都考虑使用Android 是否可以在不使用ConstraintSetStart的情况下定义运动场景过渡?,android,android-constraintlayout,Android,Android Constraintlayout,我努力创建更通用的运动布局场景。到目前为止,我看到的每个教程示例都考虑使用app:constraintSetStart=“@+id/constraintSet1” app:constraintstend=“@+id/constraintsetet2” 这是我的运动场景xml,可能有些属性声明错误 <MotionScene xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://sche
app:constraintSetStart=“@+id/constraintSet1”
app:constraintstend=“@+id/constraintsetet2”
这是我的运动场景xml,可能有些属性声明错误
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition android:id="@+id/title1_motion"
app:duration="1000"
app:constraintSetEnd="@+id/title1_down">
<onClick
app:clickAction="toggle"
app:targetId="@id/title1_down" />
</Transition>
<ConstraintSet android:id="@+id/title1_down">
<Constraint android:id="@+id/textView1">
<Layout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/textView2"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<Transform android:translationY="50dp" />
</Constraint>
</ConstraintSet>
</MotionScene>
我现在实现的是一个smiple机制,它通过MotionLayout.TransitionListener
跟踪当前的constraintSetId
。根据上一次运动布局转换,可以使用
transitionstate(int-id)
后接transitionontend()
,id来自transition listener
实现了从任何约束集转换的效果。以编程方式这样做是唯一可能的方法吗