私には1つの質問があります。 ボタンをクリックすると、画像ビュー(objectAnimator
)が消えます。私はonClick
の私の「アニメダウン」を持っていて、すべてのことはとてもシンプルです。私はボタンをクリックしてイメージがダウンします。そこに私は質問があります。アニメーションが最初のボタンをクリックするだけで動きます
まず、私のコードがある:初めて私はボタンをクリックすると、画像がダウンしても(それが正しいか)まだそこに立って、私はそれをしたいと思います:
ObjectAnimator objectAnimatorBlock1 = getDownObjectAnimator(imageBlock1);
animatorSetBlock1 = new AnimatorSet();
animatorSetBlock1.play(objectAnimatorBlock1);
animatorSetBlock1.start();
private ObjectAnimator getDownObjectAnimator(View v) {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(v, "translationY", 0.0f, 860.0f);
objectAnimator.setDuration(2000);
return objectAnimator;
and XML:
<ImageView
android:contentDescription="@string/image_description"
android:layout_marginRight="202dp"
android:layout_marginEnd="202dp"
android:layout_marginTop="-155dp"
android:layout_width="200dp"
android:layout_height="90dp"
android:id="@+id/imageBlock1"
android:layout_gravity="end|center_vertical"
android:src="@drawable/distance11" />
<Button
android:layout_width="60dp"
android:onClick="countIN"
android:layout_marginLeft="20dp"
android:layout_height="61dp"
android:text="DROP THE BLOCK"
android:id="@+id/button2"
android:layout_gravity="start|center_vertical"
android:background="@drawable/layout100"
android:textStyle="normal|bold|italic" />
私の問題はあります最初にボタンをクリックすると画像がただちに消えます。最初のクリックアニメーションがクリアされた後(アニメーションを終了)、次に2番目、3番目、4番目、...クリックすると、画像には何の影響もありません(移動しません)。どのようにすればいいのですか?