/*进度条移动的方法*/ private void startProgress(final double progress1){ final int width=progress.getWidth(); final ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); lp.height=progress.getHeight(); ValueAnimator animator = ValueAnimator.ofInt(0, (int)progress1*width); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int now= (int) animation.getAnimatedValue(); lp.width=now; progress.setLayoutParams(lp); } }); animator.setDuration(3000); animator.start(); }
基础的一个动画
最新推荐文章于 2023-06-04 23:55:33 发布