Change Background color and font color

前端 未结 3 659
时光取名叫无心
时光取名叫无心 2020-12-10 06:10

I want to change my WebView\'s background color and font size.

相关标签:
3条回答
  • 2020-12-10 06:37

    You could call some javascript that would modify the CSS of the loaded page.

    0 讨论(0)
  • 2020-12-10 06:51

    Assuming that you have defined your webview in an XML layout resource you can do the following:

    WebView myWebView = (WebView) findViewById(R.id.myWebView);
    myWebView.setBackgroundColor(Color.parseColor("#000000"));
    myWebView.getSettings.setDefaultFontSize(10);
    

    You may also want to enable javascript and create a simple WebClient to handle page loading

    Hope it helps!

    0 讨论(0)
  • 2020-12-10 06:56

    I would think you can't - unless you control the html data displayed.

    The font and background are controlled by the html data feed to the Webview and not the Webview itself.

    0 讨论(0)
提交回复
热议问题