【发布时间】:2017-09-19 11:52:40
【问题描述】:
我想要片段之间的动画。 第二个片段应该从右下角滑出,第一个片段(当前片段应该保持原样)应该在点击 FAB 按钮时发生。
我尝试过的。
ft.setCustomAnimations(R.anim.slide_in_from_bottom_right,R.anim.stay);
ft.replace(R.id.sample_content_fragment, fragment, "XYZ");
ft.addToBackStack("XYZ");
Bundle bundle = new Bundle();
fragment.setArguments(bundle);
ft.commit();
slide_in_from_bottom_right.xml:-
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="100%p" android:fromXDelta="100%p" android:toYDelta="0%p"
android:duration="600"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
/>
</set>
stay.xml:-
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="600"/>
</set>
问题是我看不到实际的滑入。 我在这里错过了什么?
【问题讨论】:
标签: android animation fragment