加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

使用定义在xml下的动画

发布时间:2020-12-16 02:22:18 所属栏目:百科 来源:网络整理
导读:一、Drawable Animation animation-list为根元素,以item表示要轮换显示的图片,duration属性表示各项显示的时间。 XML文件要放在/res/drawable/目录下 anim = (AnimationDrawable) imageView.getBackground(); anim.stop(); anim.start(); 二、Tweene res文

一、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);//设置动画作用的目标对象

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读