アイコンとテキストをグループ化するために、それらを線形レイアウトでグループ化し、線形レイアウトのリスナーを実装しました。onclicklistenerからLinearLayoutへの問題
<LinearLayout
android:id="@+id/ll0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/start" />
<TextView
android:id="@+id/textView0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
私は、リスナー、以下の方法を実装している: - 私は直面しています
l0 = (LinearLayout)findViewById(R.id.ll0);
l0.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
//Some Code
}
});
問題は、私はアイコンをクリックしたことは、リスナーが応答していないようです。リスナーは、テキストビューとアイコンの間のスペースをクリックすると機能しました。私は、特定の時点ではなく、全体の部分をクリック可能にしたいと思います。
アンドロイド:クリック可能ではないようですが、複合ドロアブルはうまく機能します。 – daemon54