我有LinearLayout和ListView(多选列表),其中attr宽度和高度为match_parent。我需要在LinearLayout中注册OnTouchListener,但似乎是ListView窃取事件。怎么解决这个问题?
答案 0 :(得分:0)
您应该按照以下方式制作扩展LinearLayout的自定义布局:
public class MyLayout extends LinearLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// do whatever you want with the event
// and return true so that children don't receive it
return true;
}
}