更改背景颜色和字体颜色 [英] Change Background color and font color

查看:133
本文介绍了更改背景颜色和字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变我的的WebView 的背景颜色和字体大小。

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

推荐答案

假设你定义了你的WebView中,你可以做以下的XML布局资源:

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);

您可能还需要启用javascript并创建一个简单的Web客户端来处理页面加载

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

希望它能帮助!

这篇关于更改背景颜色和字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆