android中的activity跳转动画
来源:互联网 发布:阿里云扩容数据盘 编辑:程序博客网 时间:2024/06/05 16:45
今天看到自己的项目和微信瞬间感觉差距太大了,话不多说了,总之差距很大,进入主题,activity跳转动画。
现在大多程序猿都是这样跳转:
Intent it = new (Activity1.this,Activity2.class);
startActivity(it);
这样就完事了,然而都没考虑过用户体验什么的,所以现在该说跳转动画了,
跳转动画现在大多数实现的是什么呢?
都是这些overridePendingTransition(R.anim.zoomin, R.anim.zoomout);
写个动画的XML文件,在startActivity(it);后面加上overridePendingTransition(R.anim.zoomin, R.anim.zoomout);
ok,这个无所谓,但是是不是在每次startActviity之后都要加这句代码呢,多啰嗦啊,瞧瞧人家微信怎么玩的,
微信两个style
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowAnimationStyle">@style/activityAnimation</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="activityAnimation" parent="@android:style/Animation">
<item name="android:activityOpenEnterAnimation">@anim/right_in</item>
<item name="android:activityOpenExitAnimation">@anim/left_out</item>
<item name="android:activityCloseEnterAnimation">@anim/left_in</item>
<item name="android:activityCloseExitAnimation">@anim/right_out</item>
</style>
然后在res目录下建一个anim,都知道,这是动画文件
上面的style引用的四个动画分别对应
right_in:
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="100.0%p" android:toXDelta="0.0" />
</set>
right_out:
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="0.0" android:toXDelta="100.0%p" />
</set>
left_in:
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="-100.0%p" android:toXDelta="0.0" />
</set>
left_out:
<set
xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="300" android:fromXDelta="0.0" android:toXDelta="-100.0%p" />
</set>
到了最后一步了,在清单文件配置我们的style
<application
android:name="com.example.testframe.ApplicationController"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" ></application>
以上就是做成微信那种activity平移效果的相关内容
注:如有错误请回复,感激不尽,转载注明出处
- android中的activity跳转动画
- android中的所有activity间动画跳转
- android中的所有activity间动画跳转
- android中的所有activity间动画跳转
- android中的所有activity间动画跳转
- android中的所有activity间动画跳转
- android中的所有activity间动画跳转
- android中的所有activity间动画跳转
- Android Activity跳转动画
- 主题:android中的所有activity间动画跳转
- Android--Activity之间跳转动画
- Android Activity页面跳转动画
- Android Activity间动画跳转
- Android Activity的跳转动画
- android动画效果 --- 设置activity 跳转动画
- TabActivity中的activity跳转实现动画效果
- Android中Activity跳转/切换动画
- Android中Activity跳转/切换动画
- JavaScript变量——栈内存or堆内存
- oracle 中的group by ,having 和order by
- 如何设计好的RESTful API之安全性
- constexpr变量
- poj 1404 I-Keyboard(dp+输出最优解)
- android中的activity跳转动画
- 头文件定义全局变量等问题
- error while loading shared libraries: libcudart.so.7.5: cannot open shared ......解决方法
- 关于项目配置、链接库冲突、main参数输入
- 数据在内存中存储方式学习
- 学习整合hibernate springmvc spring的 心得(1)
- 第十五周阅读程序——4
- springMVC上传附件
- [Reaver] crack wireless AP