我有一个包含以下代码的Webview:
WebSettings webSettings = webView.getSettings();
webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
webSettings.setSavePassword(false);
webSettings.setSaveFormData(false);
webSettings.setSupportZoom(false);
webView.setBackgroundColor(0);
webView.loadDataWithBaseURL(null, text, "text/html", "UTF-8", null);
webView.setOnTouchListener(onTouchListener);
webView.setVerticalScrollBarEnabled(true);
如果我注释掉
webView.setOnTouchListener(onTouchListener);
,那么WebView就会滚动,但是如果我添加它,WebView就不会滚动了,有什么原因吗?
编辑
我的侦听器OnTouchListener onTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_UP) {
//do something
}
return false;
}
};