使用xml定义补间动画
来源:互联网 发布:网络打印提示被挂起 编辑:程序博客网 时间:2024/04/20 20:44
rotate.xml:
旋转:
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:repeatMode="reverse" android:repeatCount="1"
//起始角度 android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" ></rotate></set>
//加载xml文件
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate);iv.setAnimation(animation);缩放:
scale.xml:
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:duration="2000"//动画执行模式 android:repeatMode="reverse"//动画重复次数 android:repeatCount="1"android:fromXScale="1.0" android:toXScale="0.5" android:fromYScale="1.0" android:toYScale="0.5"//相对于自身 android:pivotX="50%" android:pivotY="50%" ></scale></set>Animation scaleAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.scale);iv.setAnimation(scaleAnimation);位移:translate.xml:<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:duration="2000"//设置动画结束之后,动画停留在结束位置 android:fillAfter="true" android:repeatCount="1" android:repeatMode="reverse"//x轴不动 android:fromXDelta="0%p" android:toXDelta="0%p"//y轴移动父节点的20%的距离 android:fromYDelta="0%p" android:toYDelta="20%p" ></translate></set>Animation translateAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.translate);iv.setAnimation(translateAnimation);
0 0
- 使用xml定义补间动画
- Android 使用xml的方式定义补间动画
- xml文件定义动画(补间动画)--------常用
- 补间动画的XML设置使用
- 使用XML定义动画
- 使用补间动画
- Android 使用xml定义动画
- 补间动画使用详解
- Android 属性动画,补间动画,xml资源动画详解
- 在XML中设置补间动画
- Android笔记 xml补间动画
- Android 补间动画xml法(一)
- Android补间动画xml法(二)
- 帧动画&补间动画&xml文件自定义补间动画
- android(45)(帧动画,补间动画,xml补间动画)
- android tween animation 补间动画 xml设置动画属性
- Android 补间动画之xml动画设置
- 帧动画、补间动画(代码或xml)
- js中break,return,continue区别
- Android中视频播放以及解码
- QT皮肤编程(QT style sheet)总结
- 城管也曾是人
- PHP学习笔记十二之时间与日期(进阶篇)
- 使用xml定义补间动画
- elixir phoenix mix ecto.create时容易出的错误
- 推荐系统基本元素
- jquer 点击事件不执行
- JS数组的遍历方式for循环与for...in
- mybatis的<if test> 条件判断
- jquery File Upload 插件应用之解析返回json对象
- Java Socket重要参数讲解
- 根据IP定位所在城市(HTML,js,新浪IP地址库)