Android的CSS背景图片未找到 [英] android css background-image not found
问题描述
我试图用一个图像纹理为我的网页身体的背景。我的网页显示在Android的WebView。
I'm trying to use a image texture for my webpage body background. My webpage is shown in an Android webview.
下面是我的CSS:
body
{
font-family: helvetica;
font-size: 12px;
color: #555555;
padding: 10px;
/*background-color:#000000;*/
background-image:url(bg_header_sample.png);
}
的CSS是一个名为 Template.html
HTML文件中。无论 Template.html
和 bg_header_sample.png
在同一个资产文件夹:资产/全球
。
the css is inside an HTML file named Template.html
. both Template.html
and bg_header_sample.png
are in the same assets folder : assets/global
.
如果我取消注释背景颜色:#000000;
行我的身体变黑通缉
If I un-comment the background-color:#000000;
line my body turn to black as wanted.
但与当前的CSS我的身体保持透明......
but with the current CSS my body stay transparent ...
推荐答案
解决方案是通过编程方式做到这一点:
The solution was to do it programmatically :
webView.setBackgroundResource(R.drawable.backgroundImage);
由于在这个问题解释一下:
<一href=\"http://stackoverflow.com/questions/10280406/set-a-background-image-for-a-webview-in-android\">Set在Android的网页视图的背景图像
这篇关于Android的CSS背景图片未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!