Android中根据时间来计算两个值之间的差值
来源:互联网 发布:java hadoop基础 编辑:程序博客网 时间:2024/05/30 13:42
第一种方式:使用属性动画,知道开始值,结束值,然后设置时间
private void runInt() {ValueAnimator valueAnimator = ValueAnimator.ofInt(1, (int) 900);valueAnimator.setDuration(2000);valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {@Overridepublic void onAnimationUpdate(ValueAnimator valueAnimator) {// 设置瞬时的数据值到界面上btnStart.setText(valueAnimator.getAnimatedValue().toString());}});valueAnimator.start();}
第二处方式:也是使用动画,这个值是从0到1之间的变化值来改变也可以设置时间
class BarAnimation extends Animation {@Overrideprotected void applyTransformation(float interpolatedTime, Transformation t) {super.applyTransformation(interpolatedTime, t);if (interpolatedTime < 1.0f) {mProgressAni = (int) (interpolatedTime * 800);} else {mProgressAni = 800;}// postInvalidate();System.out.println("secodar---" + pbRunDistPer.getProgress() + "----mProgressAni----" + mProgressAni+ "----interpolatedTime---" + interpolatedTime);pbRunDistPer.setProgress(mProgressAni);}}
BarAnimation anim = new BarAnimation();
使用方式也非常简单主是View.startAnimation(anim); 0 0
- Android中根据时间来计算两个值之间的差值
- 通过Calendar 来计算两个时间之间的差值
- 两个相邻时间之间的差值计算
- 计算两个时间的差值
- oracle中计算两个日期之间的差值
- C#中使用TimeSpan计算两个时间的差值
- C#中使用TimeSpan计算两个时间的差值
- C#中使用TimeSpan计算两个时间的差值
- C#中使用TimeSpan计算两个时间的差值
- C#中使用TimeSpan计算两个时间的差值
- 怎么计算两个日期之间的差值
- C#两个时间之间的差值
- 获取两个时间之间的差值
- 计算SharePoint两个日期和时间字段之间的时间差值
- 计算两个时间点的差值
- c#计算两个时间的差值
- php计算两个时间的差值
- Oracle 计算两个时间的差值
- QT5.4.2静态编译(包含QtWebKit)及配置方法
- 素数求和问题(素数打表)
- Android平台arm64 ptrace hook bridge_code debug
- Scala单元测试
- SpringMVC使用@ResponseBody时返回json的日期格式
- Android中根据时间来计算两个值之间的差值
- swift 学习资料网站
- iOS7以后,我们如何统计和跟踪用户
- MATLAB feof和~feof函数用法
- jvm启动一段时间后无法使用的原因
- table样式
- The entitlements specified in your application’s Code Signing Entitlements file do not match those s
- MPP VS HADOOP场景分析
- react学习札记(二)