[英]Change Background color and font color
我想改变我的WebView
的背景颜色和字体大小。
Assuming that you have defined your webview in an XML layout resource you can do the following: 假设您已在XML布局资源中定义了webview,则可以执行以下操作:
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 您可能还想启用javascript并创建一个简单的WebClient来处理页面加载
Hope it helps! 希望能帮助到你!
你可以调用一些javascript来修改加载页面的CSS。
I would think you can't - unless you control the html data displayed. 我认为你不能 - 除非你控制显示的HTML数据。
The font and background are controlled by the html data feed to the Webview and not the Webview itself. 字体和背景由Webview的html数据提要控制,而不是Webview本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.