У меня есть LinearLayout
, который имеет 2 детей, которые используются только в качестве предварительного просмотра.LinearLayout
функциональность здесь такая же, как и Button
.Я хочу отключить любое взаимодействие с его дочерними элементами, но сделать LinearLayout
кликабельным, используя onClickListener
.В настоящее время, если я нажму Spinner
, это не вызовет onClickListener
из LinearLayout
.Я также позвонил spinner.isEnabled = false
в коде.
Расположение:
<LinearLayout
android:id="@+id/clickableLayout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical">
<Spinner
android:id="@+id/picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:enabled="false"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false">
</Spinner>
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:textColor="@color/colorBlack"
android:textSize="14dp"
android:enabled="false"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:singleLine="true"
android:duplicateParentState="true"
android:maxLength="9"/>
</LinearLayout>