コードに問題があります。テキストを回転させようとするとすべてが機能しますが、キャンバスを復元したいので呼び出しますcanvas.restore();
私がそれをすると、私のアプリはすぐにシャットダウンします...
私のコードの一部:
画面の一部に触れる:
if (wahrheitswert1 == true) {
x = 480;
y = 100;
// draw bounding rect before rotating text
Rect rect = new Rect();
canvas.translate(x, y);
// undo the translate
canvas.translate(-x, -y);
// rotate the canvas on center of the text to draw
canvas.rotate(-180, x + rect.exactCenterX(), y + rect.exactCenterY());
// draw the rotated text
canvas.drawText("Spieler1 touch", x, y, paint);
//undo the rotate
//canvas.restore();
wahrheitswert1 = false;
canvas.restore();
}
ビットマップを復元しないと、背景画像が画面の他のサイトからコピーされます。ご協力いただきありがとうございます