webview showing white bar on right side

前端 未结 4 1244
一个人的身影
一个人的身影 2021-01-29 21:50

I am giving the following method call to my webview client embedded in my layout
wv.loadData(\"

4条回答
  •  再見小時候
    2021-01-29 22:33

    My app has a selectable night-mode which switches to white on black. The central View is a WebView displaying text.

    For night-mode I used an extra css file that showed white text on a black backbround but users complained about the white scrollbar on the right. So I had much the same problem as outlined above. However, I needed to switch in and out of night-mode programatically at runtime but I didn't want merely to hide the scrollbars.

    The simple solution I used was:

    if (isNightMode()) {
        webView.setBackgroundColor(Color.BLACK);
    } else {
        webView.setBackgroundColor(Color.WHITE);
    }
    

    Setting the backgroundColor of the WebView affected the scrollbars as required.

提交回复
热议问题