1.在webview的父布局中设置android:focusable="true" android:focusableInTouchMode="true"属性。
2.监听webview的ontouch事件:
web.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_MOVE:
v.setFocusable(false);
v.setFocusableInTouchMode(false);
break;
case MotionEvent.ACTION_UP:
v.setFocusable(true);
v.setFocusableInTouchMode(true);
break;
default:
break;
}
return false;
}
});