Chinaunix首页 | 论坛 | 博客
  • 博客访问: 836826
  • 博文数量: 182
  • 博客积分: 1992
  • 博客等级: 上尉
  • 技术积分: 1766
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-18 11:49
文章分类

全部博文(182)

文章存档

2019年(1)

2016年(5)

2015年(29)

2014年(38)

2013年(21)

2012年(36)

2011年(52)

我的朋友

分类: Android平台

2013-07-26 12:50:53


点击(此处)折叠或打开

  1. TextView t;
  2.     Animation a;
  3.     //ObjectAnimator anim;
  4.     AnimatorSet set = new AnimatorSet();
  5.     @Override
  6.     protected void onCreate(Bundle savedInstanceState) {
  7.         super.onCreate(savedInstanceState);
  8.         setContentView(R.layout.activity_main);
  9.         
  10.         t = (TextView) findViewById(R.id.text);
  11.         a = AnimationUtils.loadAnimation(this, R.anim.fade_in);
  12.         
  13.         /*t.post(new Runnable() {
  14.             
  15.             @Override
  16.             public void run() {
  17.                 // TODO Auto-generated method stub
  18.                 t.startAnimation(a);
  19.             }
  20.         });*/
  21.         Button b = (Button) findViewById(R.id.btn);
  22.         b.setOnClickListener(new OnClickListener() {
  23.             
  24.             @Override
  25.             public void onClick(View v) {
  26.                 // TODO Auto-generated method stub
  27.                 //t.startAnimation(a);
  28.                 //anim.start();
  29.                 set.start();
  30.             }
  31.         });
  32.         
  33.         ObjectAnimator fadeOut = ObjectAnimator.ofFloat(t, "alpha", 1f, 0f);
  34.         ObjectAnimator fadeIn = ObjectAnimator.ofFloat(t, "alpha", 0f, 1f);
  35.         fadeOut.setDuration(2000);
  36.         fadeIn.setDuration(2000);
  37.         set.playSequentially(fadeIn , fadeOut);
  38.     }

阅读(977) | 评论(0) | 转发(0) |
0

上一篇:Magick++ compile options

下一篇:修改grub2

给主人留下些什么吧!~~