微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用定义在xml下的动画

一、Drawable Animation

<animation-list>为根元素,以<item>表示要轮换显示图片,duration属性表示各项显示的时间。
XML文件要放在/res/drawable/目录下
anim = (AnimationDrawable) imageView.getBackground();

anim.stop(); anim.start();


二、Tweene

res文件夹下建立anim文件
ser-<set>
alpha-<alpha>
scale-<scale>
....
Animation animation = AnimationUtils.loadAnimation(context,R.anim.xx);


三、属性动画

在XML声明中所使用的对应的XML标签: ValueAnimator- <animator> ObjectAnimator- <objectAnimator> AnimatorSet- <set> ObjectAnimator scaleAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(this,R.animator.scale_object_animator); scaleAnimator.setTarget(imageview_scale);//设置动画作用的目标对象

原文地址:https://www.jb51.cc/xml/295156.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。