1. [代码]new_dync_out_to_left.xml(带动态效果移动)
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:toXDelta
=
"2%p"
/>
<
translate
android:duration
=
"1000"
android:fromXDelta
=
"2%p"
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:startOffset
=
"200"
android:toXDelta
=
"0%p"
/>
|
3. [代码]调用代码 跳至 [1] [2] [3] [全屏预览]
1
2
3
4
5
|
Intent intent =
new
Intent();
intent.setClass(ActivitySwitchDemoActivity.
this
, SecondActivity.
class
);
startActivity(intent);
//设置切换动画,从右边进入,左边退出,带动态效果
overridePendingTransition(R.anim.new_dync_in_from_right, R.anim.new_dync_out_to_left);
|