我的 android 動畫有問題。當我第一次單擊我的 ImageView 時,我的圖像有旋轉,但是當我第二次單擊我的 ImageView 時,旋轉不起作用。為什么會這樣?我在 Java 代碼中的旋轉方法:private boolean tomIsInvisible = false;public void eraseTom(View view) { ImageView tom = findViewById(R.id.tom); ImageView jerry = findViewById(R.id.jerry); if (tomIsInvisible) { tom.animate() .rotation(3600) .scaleX(1) .scaleY(1) .alpha(1) .setDuration(3000); jerry.animate() .rotation(3600) .scaleX(0) .scaleY(0) .alpha(0) .setDuration(3000); tomIsInvisible = false; } else if(!tomIsInvisible) { tom.animate() .rotation(3600) .scaleX(0) .scaleY(0) .alpha(0) .setDuration(3000); jerry.animate() .rotation(3600) .alpha(1) .scaleX(1) .scaleY(1) .setDuration(3000); tomIsInvisible = true; }}我的 ImageView 上的其他方法可以正常工作。
帶有一些 ImageViews 的動畫包
慕碼人8056858
2022-12-21 10:09:30