私はいくつか持っていListView
ます。各リスト要素は、次のようなレイアウトを使用して作成されます。
<SomeRootLayout android:background="@layout/some_other_selector">
<TextView android:background="@layout/some_selector"/>
<TextView android:background="@layout/some_selector"/>
<ImageView/>
</SomeRootLayout>
は次のsome_selector.xml
ようになります。
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/ic_btn_stop_pressed" />
<item android:drawable="@drawable/ic_btn_stop_default" />
</selector>
これで、ユーザーが行全体を押すと、各TextViewも押されます(実際には押されません。onClickイベントは生成されませんが、TextViewはセレクターに応じて背景を変更します)。親から子のビューにタッチイベントを伝播しないようにシステムに指示するアイデアはありますか?