使用overridePendingTransition()方法,打开、关闭activity有动画
2016-03-01 14:57
781 查看
1、代码
2、res/anim/left_in
3、res/anim/left_out
4、res/anim/right_out
5、res/anim/right_in
使用者四个动画文件就可以组合成你需要的动画效果了。
public void goBack(View v) { super.goBack(v); //这个是返回从左往右的动画,就是当前的activity向右划出,另一个activity从左边进来 overridePendingTransition(R.anim.left_in, R.anim.right_out); }
2、res/anim/left_in
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="-100%" android:toXDelta="0" android:duration="500"> </translate>
3、res/anim/left_out
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="0" android:toXDelta="-100%" android:duration="500"> </translate>
4、res/anim/right_out
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="0" android:toXDelta="100%" android:duration="500"> </translate>
5、res/anim/right_in
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="100%" android:toXDelta="0" android:duration="500"> </translate>
使用者四个动画文件就可以组合成你需要的动画效果了。
相关文章推荐
- JEPF 软件快速开发平台
- 基于spring和mybatis项目的JUnit测试用例的实现
- android自定义主题样式
- Maven环境配置
- Exercise #5
- Linux常用命令
- mysql运维3--备份
- UIKit框架(21)UITableView实现复杂单元格(二)
- iOS---Bluetooth工作流程
- java.lang.Object.clone()分析
- K9000 常识
- Qt安装配置
- 系统默认alert弹出框域名title问题
- 贪心算法
- django:field字段类型
- 准备使用马克飞象写博客
- ThreadPoolExecutor
- iOS---Bluetooth工作流程
- 销售订单按交货单合并Billing
- Eclipse下.lds文件解析