Animation的学问
来源:互联网 发布:java实现邮件收发 编辑:程序博客网 时间:2024/05/24 06:38
动画播放相信大家一定不会陌生,不过动画的大杀器很多人可能没用过,这里提供三种较为简便的方式开展动画的制作,近期在写的程序总结出来打个点
动画加载的三种方式
第一种
注意AnimationUtils的使用,这里 少了很多麻烦的事情,代码的具体的类需要指定的东西过多,这里写好xml加载进来,让动画尽情的转起来
private void showHead(View head, View content) { head.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_top)); content.startAnimation(AnimationUtils.loadAnimation(this, R.anim.content_down)); content.setPadding(0, 200, 0, 0); }
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/decelerate_interpolator" > <translate android:duration="5000" android:fromYDelta="-200" android:toYDelta="0" /></set>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/decelerate_interpolator" > <translate android:duration="5000" android:fromYDelta="-200" android:toYDelta="0" /></set>
利用系统的AnimationUtils进行动画的播放,这里面可以省掉自己书写很多的参数也算是比较方便
第二种方式:.
int version = Integer.valueOf(android.os.Build.VERSION.SDK);if(version > 5 ){overridePendingTransition(R.anim.zoomin, R.anim.zoomout);}注意最关键的这个方法的注释,和两个参数的作用,这个作用很大的,对于outside的Activity也是有作用的
void android.app.Activity.overridePendingTransition(int enterAnim, int exitAnim)Call immediately after one of the flavors of startActivity(Intent) or finish to specify an explicit transition animation to perform next. As of android.os.Build.VERSION_CODES.JELLY_BEAN an alternative to using this with starting activities is to supply the desired animation information through a ActivityOptions bundle to or a related function. This allows you to specify a custom animation even when starting an activity from outside the context of the current top activity.Parameters:enterAnim A resource ID of the animation resource to use for the incoming activity. Use 0 for no animation.exitAnim A resource ID of the animation resource to use for the outgoing activity. Use 0 for no animation.
传统的方式 五种动画 直接new出来,然后使用AnimationSet或者单独使用某一个,然后view执行动画
动画的执行方式不止这几种关键是用的好,用的到位才行
简单总结,随后会更新
0 0
- Animation的学问
- Animation的学问
- 数据库关闭的学问
- 兵器的学问
- 西装的学问(zt)
- 拉客的学问
- 喝酒的学问
- 买彩票的学问
- 说话的学问
- 喝水的学问
- 管理的学问
- 树的学问ajax
- 关闭的学问
- 有关睡觉的学问
- 有关睡觉的学问
- 手机使用的学问
- 写简历的学问
- SQL null 的学问
- JavaWeb:报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
- 使用Myeclipse生成可执行的jar文件的方法
- HashMap与HashTable的区别、HashMap与HashSet的关系
- 连接 (SQL)
- leetcode刷题15:single number
- Animation的学问
- java中的时间
- 3Sum
- main20
- 在对话框上显示位图的方法
- Java单例模式(singleton模式)
- Goto JS apply 方法
- Spring 的IoC使用示例3
- 端午节前计划