Android上的低成本位图旋转

Android上的低成本位图旋转,android,bitmap,live-wallpaper,Android,Bitmap,Live Wallpaper,我正在为自己的实时壁纸编写代码。 墙纸(除其他外)有一个连续旋转的背景位图。位图很大(768x768px)。每次刷新屏幕时,我都会: canvas.drawColor(Color.WHITE); Matrix matrix = new Matrix(); matrix.setRotate(degrees, background.getWidth() / 2, background.getHeight() / 2); canvas.drawBitmap(background, matrix, pa

我正在为自己的实时壁纸编写代码。 墙纸(除其他外)有一个连续旋转的背景位图。位图很大(768x768px)。每次刷新屏幕时,我都会:

canvas.drawColor(Color.WHITE);
Matrix matrix = new Matrix();
matrix.setRotate(degrees, background.getWidth() / 2, background.getHeight() / 2);
canvas.drawBitmap(background, matrix, paint);
壁纸将以每秒12-18帧的速度播放。
这个太重了吗?有更好的方法吗?提前谢谢。

您可以尝试使用
动画

例如,

RotateAnimation animationRotator = new RotateAnimation(0f, 360f, 10f, 10f);
animationRotator.setInterpolator(new LinearInterpolator());
animationRotator.setRepeatCount(Animation.INFINITE); // For Infinite Rotation
animationRotator.setDuration(1000); // Duration in which one rotation should get over

yourView.startAnimation(animationRotator);

如果你有你的解决方案,请接受/支持投票答案:)目前我正在尝试你的解决方案:)@mneri这就是你想要的,干杯;)