我对 WebView(Android 3.0+)有疑问,WebView 在显示我的黑色背景(“闪烁”)之前总是显示白色背景。这是我的简单测试代码:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
webView.setBackgroundColor(Color.BLACK);
setContentView(webView);
loadWebView(webView);
webView.loadDataWithBaseURL("localhost://", "<html><head>" +
"<style>body {background-color: #000}img{max-width:100%}</style></head>" +
"<body>" +
"<img src=\"http://developer.android.com/images/practices/actionbar-phone-splitaction.png\" />" +
"</body></html>",
"text/html", "UTF-8", null);
}
我已经尝试了很多解决方案来摆脱这个问题,但并不幸运。
PS:关闭硬件加速不会出现该问题。有没有人遇到同样的问题并解决了?
谢谢你。