onClick not triggered on LinearLayout with child

后端 未结 15 1068
生来不讨喜
生来不讨喜 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:50

    Your TextView height covers the whole parent (whole layout) so you might clicking on empty space but not on the layout. Try using wrap_content for android:layout_height for your TextView. Set click listener for the layout as well.

提交回复
热议问题