Onclick Not Triggered on Linearlayout with Child

onClick not triggered on LinearLayout with child

for every child

android:duplicateParentState="true"

OnClick on linearLayout childs not working first time

Try to make child clickable, all layouts by default are not clickable:

child.setClickable(true);

EDIT
The problem seems to be the focus. It seems that the first click gives the focus to child and the second one actually clicks it.

Android: How to propagate click event to LinearLayout childs and change their drawable

Put

android:duplicateParentState="true"

in your ImageView and TextView..then the views get its drawable state (focused, pressed, etc.) from its direct parent rather than from itself.



Related Topics



Leave a reply



Submit