onClick not triggered on LinearLayout with child

Solution 1:

android:duplicateParentState="true" did not help me.

To make your layout clickable with its children you need add this option for every child:

 android:clickable="false"

Then click handling will go up to parent.

Solution 2:

for every child

android:duplicateParentState="true"

Solution 3:

This isn't your case, but I had similar problem with clickable ViewGroup. After a hour of looking for solution a found out that I set android:inputType to TextView inside my ViewGroup which was blocking onClick() listener (no idea why)

Don't use android:inputType with TextView

Solution 4:

Make Your parent LinearLayout's android:clickable="true"

Make all of the the childview's android:clickable="false"

Under Linearlayout - Remove android:inputType="" from TextView

Solution 5:

The android:duplicateParentState="true" made my TextView looks like it's disabled, and cannot receive click event.

All you need is set the TextView clickable="false". So the click event will dispatch to parent layout, and the TextView still can react to touch event (with ripple effect).