Change Background color and font color

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

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

3条回答
  •  盖世英雄少女心
    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!

提交回复
热议问题