Я играю с MotionLayout в Android. Я использую альфа 2 версию.
'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
Я хочу реагировать на два разных нажатия кнопок и запускать анимацию для каждого из них. Мой текущий подход состоит в том, чтобы установить два Transitions
в MotionScene
с триггером OnClick
в каждом из них.
Проблема в том, что вроде бы обнаружен только первый переход. Для второго просто ничего не происходит. Я что-то не так делаю или можно просто установить один переход на MotionScene
? Если это так, то есть ли другое решение проблемы?
Вот важные части моей сцены движения
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetStart="@id/startHome"
motion:constraintSetEnd="@id/endHome"
motion:duration="300">
<OnClick
motion:mode="toggle"
motion:target="@+id/imageView_bottom_home" />
</Transition>
<Transition
motion:constraintSetStart="@id/startSearch"
motion:constraintSetEnd="@id/endSearch"
motion:duration="300">
<OnClick
motion:mode="toggle"
motion:target="@+id/imageView_bottom_search" />
</Transition>
<ConstraintSet android:id="@+id/startSearch">
<Constraint
android:id="@id/imageView_bottom_search"
...startConstraints... />
</ConstraintSet>
<ConstraintSet android:id="@+id/endSearch">
<Constraint
android:id="@id/imageView_bottom_search"
...endConstraints... />
</ConstraintSet>
<ConstraintSet android:id="@+id/startHome">
<Constraint
android:id="@id/imageView_bottom_home"
...startConstraints... />
</ConstraintSet>
<ConstraintSet android:id="@+id/endHome">
<Constraint
android:id="@id/imageView_bottom_home"
...endConstraints... />
</ConstraintSet>
Any help appreciated.
С наилучшими пожеланиями