【原创体验】Activity跳转页面切换漂亮效果
2010-12-30 12:43
274 查看
据我观察 默认的两个Activity 跳转的动画是 从左往右移动
在startActivity 后调用 overridePendingTransition(int enterAnim,int exitAnim),就可以实现Activity之间的动画,
其中enterAnim 是下一个Activity的enter动画效果,exitAnim 是当前Actitvity退出的动画效果
【注意只有Android的2.0(SdkVersion版本号为5)以后的版本才支持】 测试切换效果在创建项目的时候注意选择 Android版本
@Override
public void onClick(View v) {
Intent MyIntent = new Intent();
MyIntent.setClass(Activity02.this, Other.class);
Activity02.this.startActivity(MyIntent);
//默认的两个Activity 跳转的动画是 从左往右移动
//
下面是溶解效果
//
overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
//
从左往右 快速移动
//
overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
//
进入 缩放效果 退出 放大效果
overridePendingTransition(R.anim.zoomin,R.anim.zoomout);
}
注意缩放 放大效果是自定义的。上面两种切换效果是系统提供的。
zoomin.xml 和 zoomout.xml 要放在res//anim 文件夹下 所以要先新建anim文件夹
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=/"4.5/" android:toXScale=/"3.0/"
android:fromYScale=/"4.5/" android:toYScale=/"3.0/"
android:pivotX=/"50%p/" android:pivotY=/"50%p/"
android:duration=/"@android:integer/config_mediumAnimTime/" />
</set>
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=/"@android:integer/config_mediumAnimTime/" />
<alpha android:fromAlpha=/"1.0/" android:toAlpha=/"0/"
android:duration=/"@android:integer/config_mediumAnimTime/"/>
</set>
其实切换的效果有很多 很炫 很酷 大家可以互相分享 增加用户体验.
在startActivity 后调用 overridePendingTransition(int enterAnim,int exitAnim),就可以实现Activity之间的动画,
其中enterAnim 是下一个Activity的enter动画效果,exitAnim 是当前Actitvity退出的动画效果
【注意只有Android的2.0(SdkVersion版本号为5)以后的版本才支持】 测试切换效果在创建项目的时候注意选择 Android版本
@Override
public void onClick(View v) {
Intent MyIntent = new Intent();
MyIntent.setClass(Activity02.this, Other.class);
Activity02.this.startActivity(MyIntent);
//默认的两个Activity 跳转的动画是 从左往右移动
//
下面是溶解效果
//
overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
//
从左往右 快速移动
//
overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
//
进入 缩放效果 退出 放大效果
overridePendingTransition(R.anim.zoomin,R.anim.zoomout);
}
注意缩放 放大效果是自定义的。上面两种切换效果是系统提供的。
zoomin.xml 和 zoomout.xml 要放在res//anim 文件夹下 所以要先新建anim文件夹
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=/"4.5/" android:toXScale=/"3.0/"
android:fromYScale=/"4.5/" android:toYScale=/"3.0/"
android:pivotX=/"50%p/" android:pivotY=/"50%p/"
android:duration=/"@android:integer/config_mediumAnimTime/" />
</set>
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=/"@android:integer/config_mediumAnimTime/" />
<alpha android:fromAlpha=/"1.0/" android:toAlpha=/"0/"
android:duration=/"@android:integer/config_mediumAnimTime/"/>
</set>
其实切换的效果有很多 很炫 很酷 大家可以互相分享 增加用户体验.
相关文章推荐
- Activity跳转页面切换漂亮效果(转)
- Activity跳转页面切换漂亮效果(转)
- Activity跳转页面切换漂亮效果(转)
- Activity间跳转时的效果设计,页面切换效果
- Activity页面切换效果
- Android 关于Activity的跳转和finish时切换页面动画实现
- Android 自定义Activity漂亮跳转效果
- Android 左右滑动切换页面或Activity的效果实现
- 自定义Activity漂亮跳转效果
- Activity页面跳转时的过度效果
- Android实现Activity页面跳转切换动画特效
- Android 自定义Activity漂亮跳转效果
- 自定义Activity漂亮跳转效果
- 两个activity界面间跳转切换动画效果
- Android 自定义Activity漂亮跳转效果
- Activity页面切换效果
- android学习笔记---56_activity切换动画与页面切换动画,自定义activity窗口切换动画效果的实现.
- Android 一个Activity 里面放置多个 Fragment 实现点击切换的Tab 页面效果
- Activity页面切换的效果
- iOS 视图控制器转场动画/页面切换效果/跳转动画 学习