//属性动画(text1是你要想动的View        float translationX = text1.getTranslationX();        //获得当前按钮的位置        ObjectAnimator animator = ObjectAnimator.ofFloat(text1, "translationX", 300, translationX);        //放大        ObjectAnimator scaleX = ObjectAnimator.ofFloat(text1, "scaleX", 1f, 3f, 1f);        //透明        ObjectAnimator alpha = ObjectAnimator.ofFloat(text1, "alpha", 1f, 0f, 1f);        //旋转        ObjectAnimator rotation = ObjectAnimator.ofFloat(text1, "rotation", 0f, 360f);        //背景渐变颜色        ObjectAnimator backgroundColor = ObjectAnimator.ofInt(text1, "backgroundColor", 0x00FFFFFF , 0x6600ff00);        //不加它的话是闪光灯效果一样(在这里不加了            //backgroundColor.setEvaluator(new ArgbEvaluator());        //组合动画        AnimatorSet animatorSet = new AnimatorSet();        animatorSet.play(animator).with(scaleX).with(alpha).with(rotation).before(backgroundColor);        animatorSet.setDuration(5000);        animatorSet.start();        //动画监听        animatorSet.addListener(new AnimatorListenerAdapter() {            @Override            public void onAnimationEnd(Animator animation) {                super.onAnimationEnd(animation);                Toast.makeText(Main2Activity.this,"动画结束",Toast.LENGTH_LONG).show();            }        });    }

更多相关文章

  1. Android动画播放的常用方式
  2. android之Tabhost深入讲解二
  3. 安卓课程十八 RadioButton单选按钮的使用
  4. Android(安卓)标题栏上加一个返回按钮 超简单的返回
  5. Pair 了解一下
  6. [置顶] android 幻灯片效果之小方块渐入渐出
  7. Android(安卓)databinding RecycleView item 子控件点击事件
  8. Android打开摄像头拍照,并显示出来
  9. Android(安卓)属性动画(二)

随机推荐

  1. include及merge在androidmanifest.xml中
  2. Android各个版本 版本号对应关系表
  3. android 添加混淆
  4. Android(安卓)NDK 工具链的使用方法(Stand
  5. Android‘s process
  6. 让TextView的drawable与文字一起居中
  7. Android:音视频刻录
  8. Universal Image Loader库使用方法
  9. android圆盘菜单效果
  10. 自定义线程池管理类