ValueAnimator mAnimator = ValueAnimator.ofFloat(0, mWaveWidth);
mAnimator.setInterpolator(new LinearInterpolator());
mAnimator.addUpdateListener(animation -> {
mOffset = (float) animation.getAnimatedValue();
mWavePath = getPath();
invalidate();
});
mAnimator.setDuration(10000);
mAnimator.setRepeatCount(ValueAnimator.INFINITE);
mAnimator.start();
已经移除动画改成每2S一次invalidate(),没有问题了且CPU占用率稳定70+%
但这无限循环的代码,设备静置一天会提高CPU占用率,开始时是80+%,一天后是约为100%是为啥?