增加动画的效果

a) alpha(AlphaAnimation)

渐变透明

b) scale(ScaleAnimation)

渐变尺寸伸缩

c) translate(TranslateAnimation)

画面转换、位置移动

d) rotate(RotateAnimation)

画面转移,旋转动画

 1 public void onClick(View v) {
 2                 if(grid_list) {
 3                     lv.setVisibility(View.VISIBLE);
 4                     gv.setVisibility(View.GONE);
 5                     lv.setAdapter(lvAdapter);
 6                     grid_list = false;
 7                     
 8                     Animation animation = new RotateAnimation(60,0);
 9                     animation.setInterpolator(MainActivity.this, android.R.anim.bounce_interpolator);
10                     animation.setDuration(1000);
11                     
12                     lv.startAnimation(animation);
13                 }
14                 else {
15                     lv.setVisibility(View.GONE);
16                     gv.setVisibility(View.VISIBLE);
17                     gv.setAdapter(gvAdapter);
18                     grid_list = true;
19                     Animation animation = new TranslateAnimation(130, 1, 130, 1);
20                     animation.setDuration(1000);
21                     animation.setInterpolator(MainActivity.this, android.R.anim.overshoot_interpolator);
22                     //setInterpolator用来丰富动画效果,上面是超过又回来
23                     gv.startAnimation(animation);
24                 }

 若想让一个VIEW呈现多种动画效果,则要使用AnimationSet

例如:

AnimationSet set = new AnimationSet(false);

set.addAnimation(animation);

VIEW.startAnimation(set);

可以理解为set是一种混合型的动画效果。

 

转载于:https://www.cnblogs.com/hixin/p/4125087.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值