Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android HTML WebView不支持';不显示背景图像_Android_Html_Webview_Background Image_Background Color - Fatal编程技术网

Android HTML WebView不支持';不显示背景图像

Android HTML WebView不支持';不显示背景图像,android,html,webview,background-image,background-color,Android,Html,Webview,Background Image,Background Color,我正在尝试将HTML文件实现到WebView中。问题是,这些图像,包括HTML文件引用的背景图像,都没有显示出来但仅在模拟器中。背景图像在浏览器中工作得很好 我把它简化为一个最小的代码,但它仍然不起作用。背景色效果良好,但所有背景图像均不可见: HTML文件Test.HTML: <html> <head> </head> <body background="ipad_bg.jpg" bgcolor="#5611cc"> Test </bod

我正在尝试将HTML文件实现到WebView中。问题是,这些图像,包括HTML文件引用的背景图像,都没有显示出来但仅在模拟器中。背景图像在浏览器中工作得很好

我把它简化为一个最小的代码,但它仍然不起作用。背景色效果良好,但所有背景图像均不可见:

HTML文件Test.HTML:

<html>
<head>

</head>
<body background="ipad_bg.jpg" bgcolor="#5611cc">
Test
</body>
</html>
ueber_layout.xml:

<?xml version="1.0" encoding="utf-8"?>
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ueber_webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

Test.html文件位于资产文件夹中,图像ipad_bg.jpg也在其中。 因此,显示的是颜色,而不是图像。


有人有主意了吗?

试着像这样打开你的网页:

mWebView.loadUrl("file:///android_asset/Test.html");

我的html页面中也有图像,对我来说效果很好。

为什么不使用webView的loadUrl功能直接加载html页面?谢谢,这就是解决方案。。在两者之间,但通过搜索错误,我改变了它。谢谢,这是解决方案。已经有了,但同时我不幸地改变了它
mWebView.loadUrl("file:///android_asset/Test.html");