解决scrollView中嵌套编辑框导致不能上下滑动的问题
重写EditText的onTouchEvent方法1
2
3
4
5
6
7
8
9
10
public boolean onTouchEvent(MotionEvent event) {
//解决EditText嵌套到ScrollView中时不能滚动的问题
if(event.getAction()==MotionEvent.ACTION_DOWN){
this.getParent().requestDisallowInterceptTouchEvent(true);
} else if(event.getAction() == MotionEvent.ACTION_UP){
this.getParent().requestDisallowInterceptTouchEvent(false);
}
return super.onTouchEvent(event);
}
1 | mGoodsDesEditText.setOnTouchListener(new View.OnTouchListener() { |