intent跳转时添加动画效果实例
来源:互联网 发布:调节阀计算软件 编辑:程序博客网 时间:2024/05/17 21:53
系统默认的intent跳转效果非常生硬,丑陋,影响用户体验,怎么添加跳转动画呢?
首先新建两个动画文件:
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="300" /> <!-- 这里为了看到动画演示效果,把动画持续时间设为3秒 --> <alpha android:fromAlpha="0.1" android:toAlpha="1.0" android:duration="300" /> </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="300" /> <!-- 系统内置的动画持续时间 android:duration="@android:integer/config_mediumAnimTime" --> <alpha android:fromAlpha="1.0" android:toAlpha="0" android:duration="300"/> </set>
然后只需在startActivity(intent)后面添加一句:
overridePendingTransition(R.anim.zoomin, R.anim.zoomout);
即可实现跳转动画效果,可以试试。
1 2
- intent跳转时添加动画效果实例
- intent跳转的动画效果
- intent跳转的动画效果
- intent跳转的动画效果
- WP7中为页面跳转添加动画效果
- 动画效果汇总(一):页面跳转和添加
- 跳转Activity时,加入动画效果
- 跳转Activity时,加入动画效果(2)
- tab跳转动画效果
- 在启动activity时添加动画效果
- Fragment之间切换时添加动画效果
- 销毁Activity时添加动画效果
- android添加动画效果
- Fragment添加动画效果
- activity添加动画效果
- ViewPager 添加动画效果
- ViewPager添加动画效果
- ViewController之间跳转动画效果
- IIS8.5关于“ 配置错误 不能在此路径中使用此配置节”的解决办法
- mybatis实战教程(mybatis in action),mybatis入门到精通
- Gradle 1.12用户指南翻译——第二十八章. Jetty 插件
- ecshop用户注册如何去掉邮箱
- Altium Designer PCB板中各层的作用
- intent跳转时添加动画效果实例
- 关于openwrt 平均负载的含义
- myeclipse安装svn插件
- WPF 4.5和C#(3.2)——布局(Border,WrapPanel,DockPanel)
- 跟我学python(6)----nosetests脚本学习
- 一个解决Handler Leak的NoLeakHandler<T>类
- 触摸屏驱动笔记
- linux下追查线上问题常用命令
- C++中vector使用详细说明