The whole thing looks like this:
+---------+---------+
| Mon | 10:00AM |
+---------+---------+
It's a LinearLayout with two TextViews. I want click events to go through 'Mon' part and change background of the LinearLayout on click. '10:00AM' still needs to accept separate click events.
The XML:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="@drawable/button_filled_white"
android:clickable="true"
>
<TextView android:text="MON"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="false"
android:enabled="false"
android:focusable="false"
/>
<TextView android:text="10:00AM"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/txtTime"
/>
</LinearLayout>
To let click events to go thorough 'MON' TextView, I tried setting clickable, focusable and enabled to false in a various combination but still, the background of LinearLayout doesn't change.
If I remove child TextViews, the LinearLayout is clickable and I can see the background changing its color when clicked:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="@drawable/button_filled_white"
android:clickable="true"
/>
I'm aware of ViewGroup.onInterceptTouchEvent() but I'm looking for a XML way since handling ViewGroup.onInterceptTouchEvent() requires situation specific and view id specific implementations.