android Animation
来源:互联网 发布:小七网络毛毯中学 编辑:程序博客网 时间:2024/05/16 06:22
- 动画的介绍
android的animation一共4种类型:alpha、scale、translate、rotate(透明度、缩放、位置移动、旋转) - 动画的模式
一种是渐变型的:alpha和scale
一种是转动型的:translate和rotate - animation的使用,分为2种,一种是在xml加入动画,然后动态加载xml;第二种是java代码声明对象。
在xml文件中定义动画,在res目录中创建fade_in.xml(自动存放在anim目录下),内容如下:
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"></set>
把set改为相应的类型,例如:
<?xml version="1.0" encoding="utf-8"?><alpha xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:fromAlpha="0.0" android:interpolator="@android:anim/accelerate_interpolator" android:toAlpha="1.0" ></alpha>
然后在java代码加载改xml,内容如下:
Animation alphaAnimation = AnimationUtils.loadAnimation(AnimActivity.this,R.anim.fade_in);imageView.startAnimation(alphaAnimation);
第二种方法,在代码直接创建animation 对象,内容如下:
AnimationSet animationSet1 = new AnimationSet(true); ScaleAnimation scaleAnimation = new ScaleAnimation(0,0.1f,0,0.1f, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f); scaleAnimation.setDuration(1000); animationSet1.addAnimation(scaleAnimation); imageView.startAnimation(animationSet1);
0 0
- Android -animation-Property Animation
- Android-animation-View Animation
- Android-animation-drawable Animation
- android animation
- Android Animation
- android animation
- android Animation
- Animation Android
- Android Animation
- android animation
- android animation
- android animation
- Android Animation
- Android--Animation
- android animation
- android animation
- android Animation
- Android Animation
- Linux下编译安装php扩展php_pdo_mysql
- 遇到的查不到的异常
- 使用Redis之前5个必须了解的事情
- hive内部表与外部表区别详细介绍
- 【数据库】MySql提示:The server quit without updating PID file(…)失败
- android Animation
- RxJava 和 Spring MVC (译)
- IOS UIlabel自适应Fram后顶部出现灰色横线
- 教你理解复杂的C-C++声明
- Android数据存储和访问-登录记住密码功能
- Android事件分发机制完全解析,带你从源码的角度彻底理解
- 哈夫曼编码树的C++实现
- jquery.seat-chartsMark在线选座插件使用
- java 初探(四)