一个LinearLayout里面有一个ImageView和一个TextView,想在点击这个Layout的时候执行一个事件,于是给LinearLayout设置了onClickListener,但发现只有在点击ImageView之外部分、LinearLayout之内的部分时,才会响应点击操作,是不是ImageView把LinearLayout盖住的部分就不响应父控件LinearLayout的点击事件了呢。
如何才能让点击ImageView的时候也响应这个LinearLayout的点击事件呢,只能再给ImageView绑定相同的监听器吗?
在
LinearLayout
中添加android:descendantFocusability=”blocksDescendants”