Android 转场动画实现
程序员文章站
2024-03-24 08:37:28
...
<style name="MyTheme" parent="Light.DarkActionBar">
<item name="android:windowAnimationStyle">@style/activityAnimation</item>
</style>
<style name="activityAnimation" parent="@android:style/Animation">
<item name="android:activityOpenEnterAnimation">@anim/slide_right_in</item>
<item name="android:activityOpenExitAnimation">@anim/slide_left_out</item>
<item name="android:activityCloseEnterAnimation">@anim/slide_left_in</item>
<item name="android:activityCloseExitAnimation">@anim/slide_right_out</item>
<item name="android:taskOpenEnterAnimation">@anim/slide_right_in</item>
<item name="android:taskOpenExitAnimation">@anim/slide_left_out</item>
<item name="android:taskCloseEnterAnimation">@anim/slide_left_in</item>
<item name="android:taskCloseExitAnimation">@anim/slide_right_out</item>
</style>
slide_left_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="-100.0%p" android:toXDelta="0.0" />
</set>
slide_left_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="0.0" android:toXDelta="-100.0%p" />
</set>
slide_right_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="100.0%p" android:toXDelta="0.0" />
</set>
slide_right_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="0.0" android:toXDelta="100.0%p" />
</set>
上一篇: Android动画合集之补间动画
下一篇: android 布局的动画