アプリケーションに 3 つのボタンを作成しました。これらのボタンをクリックすると、giveClue メソッドに移動します。
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="24dp"
android:layout_height="22dp"
android:layout_alignTop="@+id/lifeButtonsLbl"
android:layout_toLeftOf="@+id/ImageButton2"
android:src="@drawable/icon"
android:onClick="giveClue" />
<ImageButton
android:id="@+id/ImageButton2"
android:layout_width="24dp"
android:layout_height="22dp"
android:layout_alignTop="@+id/imageButton1"
android:layout_toLeftOf="@+id/ImageButton3"
android:src="@drawable/icon"
android:onClick="giveClue"/>
<ImageButton
android:id="@+id/ImageButton3"
android:layout_width="24dp"
android:layout_height="22dp"
android:layout_alignRight="@+id/frameLayout1"
android:layout_alignTop="@+id/ImageButton2"
android:src="@drawable/icon"
android:onClick="giveClue" />
注:別の方法を使用したくありません
アクティビティクラス:
public void giveClue(View view) {
gameAdapter.giveClue(game);
}
私の問題は、クリックされたボタンを無効にしたいということです。ボタンごとに異なる方法を使用したくありません。どのボタンがクリックされたかを特定して無効にすることはできますか。
ありがとうございました。