【发布时间】:2012-03-17 13:59:38
【问题描述】:
我遇到了 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:关闭硬件加速不会出现此问题。有人遇到同样的问题并解决了吗?
谢谢。
【问题讨论】:
-
我有同样的问题,你能找到解决办法吗?
-
我们仍然没有解决方案/解决方法。报道在这里:code.google.com/p/android/issues/detail?id=26138和这里code.google.com/p/android/issues/detail?id=25722
-
我解决了我的问题,webView.setBackgroundColor(0);你试过了吗?
-
我试过了,还是不行。
-
仅供参考:此错误已在 Jelly Bean 中修复。
标签: android webview android-3.0-honeycomb android-4.0-ice-cream-sandwich hardware-acceleration