属性动画_
来源:互联网 发布:淘宝页面怎么设计 编辑:程序博客网 时间:2024/06/17 02:39
public class MainActivity extends AppCompatActivity { TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.tv); //参数1:要执行动画的 控件 对象 //参数2:要实行动画的 样式字符串 //参数3:可变长度的参数 用来确定该控件对象的 改变过程 ObjectAnimator animator = ObjectAnimator.ofFloat(tv, "alpha", 1f, 0f, 1f, 0.5f, 1f); animator.setDuration(5000);// animator.start(); float x = tv.getTranslationX(); ObjectAnimator animator1 = ObjectAnimator.ofFloat(tv, "translationX", x , 100, x); animator1.setDuration(5000);// animator1.start(); ObjectAnimator animator2 = ObjectAnimator.ofFloat(tv, "scaleY", 1f, 0.5f, 2f, 1f); animator2.setDuration(5000); //-------------------------------- ValueAnimator animator3 = ValueAnimator.ofObject(new ArgbEvaluator(), Color.RED, Color.BLUE); animator3.setDuration(5000); animator3.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int currentColor = (int) animation.getAnimatedValue(); tv.setTextColor(currentColor); } });// animator3.start(); AnimatorSet set = new AnimatorSet(); set.play(animator).after(animator1).before(animator2).with(animator3); set.start(); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); } }); }}
阅读全文
0 0
- android动画_属性动画
- 属性动画_
- 255_属性动画解析
- 259_属性动画监听
- 383_抖动属性动画
- 属性动画_展开菜单栏
- 属性动画_点赞
- android--(动画2_属性动画)
- 257_属性动画xml使用
- 261_属性动画组合解析
- Android基础_帧动画 补间动画 属性动画(十一)
- 属性动画+贝塞尔曲线实现落叶效果~~~(@_@;)
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画
- 属性动画的使用
- 《深入理解Nginx》读书笔记1:架构设计
- 064 不定积分之分部积分法 case 1-6 总结
- 春招准备日记day01
- 如何开发创建并玩转属于自己区块链的数字货币
- 属性动画_
- ios-FMDB多线程的使用技巧
- java设计模式(精通系列)-策略模式(Strategy)
- TabLayout横向滑动菜单code
- 实现简单登录注册
- [线段树][简单复杂度分析]LOJ#6029. 「雅礼集训 2017 Day1」市场
- okhttp封装_
- 摇骰子(随机数)2种方法
- 漏洞利用的细节