Я пытаюсь использовать макет ограничения 2.0 для макета и анимации элемента. У меня есть макет создания с движением в качестве родителя, который содержит другой линейный макет, где 1 линейный используется как ящик, а другой - для основного вида. Я хочу повернуть текстовое представление на 20 градусов, когда положение рамки linear_pink установлено на 50.
Вот мой MotionLayoutFile
<android.support.constraint.motion.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
app:layoutDescription="@xml/scene_01"
app:showPaths="true">
<android.support.constraint.Guideline
android:id="@+id/guideline_01"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.3"/>
<android.support.constraint.Guideline
android:id="@+id/guideline_02"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.1"/>
<android.support.constraint.Guideline
android:id="@+id/guideline_03"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.9"/>
<LinearLayout
android:id="@+id/linear_green"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimary"
android:gravity="center">
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="One"
android:textColor="@android:color/white"
android:textSize="20dp"
android:padding="4dp"/>
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Two"
android:textColor="@android:color/white"
android:textSize="20dp"
android:padding="4dp"/>
<TextView
android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yhree"
android:textColor="@android:color/white"
android:textSize="20dp"
android:padding="4dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/linear_pink"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.motion.MotionLayout>
вот моя сцена движения
<?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:constraintSetStart="@id/start"
app:constraintSetEnd="@id/end"
app:duration="1000">
<OnSwipe
app:touchAnchorId="@id/linear_pink"
app:touchAnchorSide="right"
app:dragDirection="dragRight"
app:maxVelocity="1"/>
<KeyFrameSet>
<KeyAttribute
app:target="@id/text1"
app:framePosition="20"
android:alpha="1"
android:rotationX="90">
<CustomAttribute
app:attributeName="TextColor"
app:customColorValue="@android:color/holo_red_dark" />
</KeyAttribute>
<KeyAttribute
app:target="@id/text2"
app:framePosition="40"
android:alpha="1"/>
<KeyAttribute
app:target="@id/text3"
app:framePosition="60"
android:alpha="1"/>
</KeyFrameSet>
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint android:id="@id/linear_green">
<Layout
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimary"/>
</Constraint>
<Constraint android:id="@id/linear_pink">
<Layout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint android:id="@id/linear_green">
<Layout
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@id/guideline_03"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/guideline_01"
app:layout_constraintTop_toTopOf="@id/guideline_02"
android:background="@color/colorPrimary"/>
</Constraint>
<Constraint android:id="@id/linear_pink">
<Layout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@id/guideline_01"
app:layout_constraintTop_toTopOf="parent"/>
</Constraint>
</ConstraintSet>
</MotionScene>