0

私は自分のライブ壁紙のコードを書いています。壁紙 (とりわけ) には、連続的に回転する背景ビットマップがあります。ビットマップは大きい (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 FPS で実行されます。これは重すぎますか?これを行うためのより良い方法はありますか? 前もって感謝します。

4

1 に答える 1

1

を使用して試すことができますAnimation

サンプル例については、

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);
于 2012-07-03T09:54:56.520 に答える