You need to set attribute android:clickable="true" for the second LinearLayout
(yellow one) with implementing NO listener to it (no changes in java). This will show the toast only when the first LinearLayout
(green one) is clicked.
P.S. You still can implement listeners to childs of the second LinearLayout
, e.g. TextView
in your case.