У меня проблема с MotionLayout. Я создал сцену, и она работает, когда я использую один переход onClick. Но мне нужно два.
Я хочу сделать следующее: при нажатии на кнопку в представлении одно это представление будет скрыто, а другое представление отобразится. Это работает. Но теперь, когда я нажимаю кнопку в другом представлении, я хочу показать первое представление, а второе нужно скрыть.
Такого рода работает, только проблема в том, что он не работает с переходом. Это просто видно.
Моя сцена выглядит так:
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@+id/start"
motion:duration="2000"
motion:motionInterpolator="easeOut">
<OnClick
motion:clickAction="transitionToEnd"
motion:targetId="@+id/hide_menu" />
</Transition>
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@+id/start"
motion:duration="2000"
motion:motionInterpolator="easeInOut">
<OnClick
motion:clickAction="transitionToStart"
motion:targetId="@+id/quick_menu_show_menu" />
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/sidebar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:translationX="0dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@+id/quick_menu"
android:layout_width="19dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:translationX="-70dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/sidebar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:translationX="-70dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
<Constraint
android:id="@+id/quick_menu"
android:layout_width="19dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:translationX="0dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
</MotionScene>
надеюсь, что кто-нибудь может помочь.
С уважением,
JKorsten