Android的Activity屏幕切换动画(一)-左右滑动切换 ,实现过程是非常简单,一些新手可能会向深入了了解 Activity 切换的原理,下面主要对左右滑动进行深入的探讨,并以项目中的一个切换效果来进一步了解。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<!--从屏幕左边退出,先退后2%p位置,再向左退出 -->
<
set
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:shareInterpolator
=
"false"
>
<
translate
android:duration
=
"200"
android:fromXDelta
=
"0%p"
android:interpolator
=
"@android:anim/accelerate_decelerate_interpolator"
android:toXDelta
=
"2%p"
/>
<
translate
android:duration
=
"1000"
android:fromXDelta
=
"2%p"
android:interpolator
=
"@android:anim/accelerate_interpolator"
android:startOffset
=
"200"
android:toXDelta
=
"-100%p"
/>
</
set
>
|
[2].[代码] new_dync_in_from_right.xml
1
2
3
4
5
6
7
8
|
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<!--从屏幕右边偏离2%位置开始进入,到达终点后有超出在返回终点的动态效果 -->
<
translate
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:duration
=
"1000"
android:fromXDelta
=
"102%p"
android:interpolator
=
"@android:anim/anticipate_overshoot_interpolator"
android:startOffset
=
"200"
android:toXDelta
=
"0%p"
/>
|