onClick not triggered on LinearLayout with child

后端 未结 15 1084
生来不讨喜
生来不讨喜 2020-11-29 03:33

I\'ve got a custom LinearLayout with a smaller TextView child. I\'d like to be able to click the area not covered by the TextView, so I set clickable=true and an onclicklist

15条回答
  •  我在风中等你
    2020-11-29 03:48

    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.

提交回复
热议问题