I want to automatically start an animation when my fragment gets displayed. I've set the autoTransition attribute to animateToEnd, but nothing happens.
I'm currently on constraintLayout beta7. When downgrading to beta6 or lower, nothing happens either except the animation being complete when the fragment enters the screen.
I've already attached a TransitionListener to the MotionLayout and observed the following:
- On beta7 OnTransitionChange is called once with a progress value so low I'll call it 0, OnTransitionEnd is never called and my TextView stays invisible
- On beta6 or lower OnTransitionChange is called twice, the first time with a rather random progress value between 0 and 0.5, and the second time with 1.0. After that, OnTransitionEnd is called and my TextView is immediatly visible, no animation there.
This is the MotionScene xml file:
<?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="1000"
motion:motionInterpolator="easeInOut"
motion:autoTransition="animateToEnd">
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint android:id="@id/splash_head_TextView">
<Layout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="@id/topGuideLine"/>
<CustomAttribute
motion:attributeName="alpha"
motion:customFloatValue="0.0" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint android:id="@id/splash_head_TextView">
<Layout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/splash_head"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="@id/topGuideLine"/>
<CustomAttribute
motion:attributeName="alpha"
motion:customFloatValue="1.0" />
</Constraint>
</ConstraintSet>
</MotionScene>