WebView webView = (WebView) findViewById(R.id.webview);
webView.setBackgroundResource(R.drawable.bg);
webView.setBackgroundColor(Color.argb(0, 0, 0, 0));
webView.loadUrl("file:///android_asset/gamehelp.html");
webView.setBackgroundResource(R.drawable.bg);
webView.setBackgroundColor(Color.argb(0, 0, 0, 0));
webView.loadUrl("file:///android_asset/gamehelp.html");
这篇博客介绍了如何在Android的WebView组件中添加背景。首先通过findViewById获取WebView实例,然后使用setBackgroundResource方法设置背景资源,接着用setBackgroundColor方法将背景颜色设置为透明,最后加载本地HTML文件。

1249

被折叠的 条评论
为什么被折叠?



