两个Activity跳转的时候,自定义翻页效果:
下面为两个自定义的动画效果XML文件,存放位置为:res/anim/
1,动画退出效果:zoomout.xml
动画演示结果:
[img]http://dl.iteye.com/upload/attachment/352398/96bf7afa-49b1-393e-b9b4-3e6c34bb491e.jpg[/img]
2,动画进入效果:zoomin.xml
动画演示结果:
1.进入过程中效果
[img]http://dl.iteye.com/upload/attachment/352400/c7b2846b-7cdc-37d6-a090-af1991463943.jpg[/img]
2.进入后效果
[img]http://dl.iteye.com/upload/attachment/352402/9081ab45-9859-31c3-8b0e-30cc276034cd.jpg[/img]
//这段只是示例代码,要看到我下面的图片演示的结果还需要自己写相应的Activity
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
startActivityForResult(intent, 11);
//添加界面切换效果,注意只有Android的2.0(SdkVersion版本号为5)以后的版本才支持
int version = Integer.valueOf(android.os.Build.VERSION.SDK);
if(version >= 5) {
overridePendingTransition(R.anim.zoomin, R.anim.zoomout); //此为自定义的动画效果,下面两个为系统的动画效果
//overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
//overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
}
下面为两个自定义的动画效果XML文件,存放位置为:res/anim/
1,动画退出效果:zoomout.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator"
android:zAdjustment="top">
<scale android:fromXScale="1.0" android:toXScale=".5"
android:fromYScale="1.0" android:toYScale=".5"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="3000" />
<!-- 系统内置的动画持续时间
android:duration="@android:integer/config_mediumAnimTime"
-->
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:duration="3000"/>
</set>
动画演示结果:
[img]http://dl.iteye.com/upload/attachment/352398/96bf7afa-49b1-393e-b9b4-3e6c34bb491e.jpg[/img]
2,动画进入效果:zoomin.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<scale android:fromXScale="0.1" android:toXScale="1.0"
android:fromYScale="0.1" android:toYScale="1.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="3000" />
<!-- 这里为了看到动画演示效果,把动画持续时间设为3秒 -->
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="3000" />
</set>
动画演示结果:
1.进入过程中效果
[img]http://dl.iteye.com/upload/attachment/352400/c7b2846b-7cdc-37d6-a090-af1991463943.jpg[/img]
2.进入后效果
[img]http://dl.iteye.com/upload/attachment/352402/9081ab45-9859-31c3-8b0e-30cc276034cd.jpg[/img]