Android WebView 样式背景颜色:在 android 2.2 上忽略透明 [英] Android WebView style background-color:transparent ignored on android 2.2

查看:22
本文介绍了Android WebView 样式背景颜色:在 android 2.2 上忽略透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力创建具有透明背景的 WebView.

I'm struggling to create a WebView with transparent background.

webView.setBackgroundColor(0x00FFFFFF);
webView.setBackgroundDrawable(myDrawable);

然后我用

<body style="background-color:transparent;" ...

WebView 的背景颜色是透明的,但是一旦加载页面,它就会被 html 页面的黑色背景覆盖.这只发生在 android 2.2 上,它适用于 android 2.1.

The background color of the WebView is transparent but as soon as the page is loaded, it's overwritten by a black background from the html page. This only happens on android 2.2, it works on android 2.1.

那么是否需要在 html 页面代码中添加一些内容以使其真正透明?

So is there something to add in the html page code to make it really transparent ?

推荐答案

实际上这是一个错误,到目前为止没有人找到解决方法.已创建问题.该错误仍然存​​在于蜂窝中.

Actually it's a bug and nobody found a workaround so far. An issue has been created. The bug is still here in honeycomb.

如果您认为它很重要,请为它加星标:http://code.google.com/p/android/issues/detail?id=14749

Please star it if you think it's important : http://code.google.com/p/android/issues/detail?id=14749

这篇关于Android WebView 样式背景颜色:在 android 2.2 上忽略透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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