HorizontalScrollView に RelativeLayouts があります。ユーザーがレイアウトの 1 つ (またはその子) をクリックすると、特定の RelativeLayout の背景色を変更し、さらに処理するためにその ID を取得する必要があります。これは、DuplicateParentState または onTouchEvent を使用して実行できることがわかりました。おすすめの方法は?
提案どおりに XML ファイルを編集した後の私の XML ファイル:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<youme.appyoume.com.ExDialog>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:clickable="true"
android:duplicateParentState="true"
android:onClick="onClick"
android:src="@drawable/ic_launcher" />
<EditText
android:id="@+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:duplicateParentState="true"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="textMultiLine"
android:text="text" >
<requestFocus />
</EditText>
</youme.appyoume.com.ExDialog>
</RelativeLayout>
ありがとう、サイモン