Hiding the scroll bar in WebView

后端 未结 8 1474
栀梦
栀梦 2020-12-03 07:05

I want to hide a vertical scroll bar in my WebView when I do not scroll the page. As for now, it is displayed always. I create a WebView programmatically, so my question is

相关标签:
8条回答
  • 2020-12-03 07:36

    No need to change your Java code.
    It will work if you put android:scrollbars="none" in your XML.

    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scrollbars="none" />
    
    0 讨论(0)
  • 2020-12-03 07:36

    Try this -

    For vertical scrollbar -

    webView.setVerticalScrollBarEnabled(false) 
    

    For Horizontal scrollbar -

    webView.setHorizontalScrollBarEnabled(false);
    
    0 讨论(0)
  • 2020-12-03 07:38

    setScrollbarFadingEnabled() method does exactly what you want. It hides scrollbar when the view isn't scrolling.

    webView.setScrollbarFadingEnabled(true);
    
    0 讨论(0)
  • 2020-12-03 07:38

    try this code,

    webView.setVerticalScrollBarEnabled(false);
    
    0 讨论(0)
  • 2020-12-03 07:43

    Set scrollbars to none in the XML for WebView. For reference try this code.

    <WebView android:id="@+id/webView"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:scrollbars="none"/> 
    
    0 讨论(0)
  • 2020-12-03 07:43

    This finally worked for me:

    mWebView.setVerticalScrollBarEnabled(false);
    
    0 讨论(0)
提交回复
热议问题