在我的应用中,我使用的是Android Activity Slide过渡,它包含在InputTextLayout中。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_vertical_margin">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="First Name "/>
</android.support.design.widget.TextInputLayout>
活动从窗口资源transition-v21 / profile_enter.xml
进入<transitionSet
xmlns:android="http://schemas.android.com/apk/res/android"
android:transitionOrdering="together"
android:duration="400"
android:interpolator="@android:interpolator/linear_out_slow_in">
<slide android:slideEdge="right">
<targets>
<target android:excludeId="@android:id/navigationBarBackground"/>
<target android:excludeId="@android:id/statusBarBackground" />
</targets>
</slide>
<fade android:duration="@android:integer/config_mediumAnimTime">
<targets>
<target android:targetId="@android:id/navigationBarBackground" />
<target android:targetId="@android:id/statusBarBackground" />
</targets>
</fade>
</transitionSet>
活动从窗口资源transition-v21 / profile_return.xml
返回<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
android:transitionOrdering="together"
android:interpolator="@android:interpolator/fast_out_linear_in">
<slide
android:slideEdge="bottom"
android:duration="300">
<targets>
<target android:excludeId="@android:id/navigationBarBackground" />
<target android:excludeId="@android:id/statusBarBackground" />
</targets>
</slide>
<fade
android:startDelay="200"
android:duration="200">
<targets>
<target android:targetId="@id/toolbar_edit_btn" />
</targets>
</fade>
<fade android:duration="400">
<targets>
<target android:targetId="@android:id/navigationBarBackground" />
<target android:targetId="@android:id/statusBarBackground" />
</targets>
</fade>
答案 0 :(得分:0)
在根布局中添加android:transitionGroup="true"
解决了这个问题。
e.g。
<android.support.constraint.ConstraintLayout
android:transitionGroup="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</android.support.constraint.ConstraintLayout>