【Android】关闭WebView滚动,disable webView scroll

有效代码:

 // disable scroll on touch
  webview.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      return (event.getAction() == MotionEvent.ACTION_MOVE);
    }
  });

————————————————————————————
以下是其它webView设置效果:

1.仅仅是隐藏滚动条ScrollBar,但滚动效果依然保留:
only hide the scrollbars, but not disable scrolling:

WebView.setVerticalScrollBarEnabled(false);
WebView.setHorizontalScrollBarEnabled(false);

2.在xml中设置滚动
scrollbars = none


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"    >
  "@+id/mywebview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbars="none" />

然后

webview.setScrollContainer(false);

have fun

转载署源-By-KyleCe:http://blog.csdn.net/kyleceshen/article/details/50381320

你可能感兴趣的:(Android问题记录)