有效代码:
// 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
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >
<WebView
android:id="@+id/mywebview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none" />
</ScrollView>
然后
webview.setScrollContainer(false);
have fun
转载署源-By-KyleCe:http://blog.csdn.net/kyleceshen/article/details/50381320
本文详细介绍了如何在Android应用中使用WebView组件,包括如何仅隐藏滚动条而不禁用滚动,如何在XML中设置滚动条样式,以及如何通过设置WebView属性来优化布局和滚动体验。同时提供了解决方案来解决滚动条显示问题。
9203

被折叠的 条评论
为什么被折叠?



