【发布时间】:2013-07-29 12:28:30
【问题描述】:
我需要使用 webview 从资产中加载大图像(大约 3500 x 3500 像素)。
我在这里对 Stackoverflow 进行了大量研究,但没有一个答案对我有用。我认为这可能是 Android 4.0+ 使用资产的问题。
我当前的代码如下:
WebView webView = (WebView)findViewById(R.id.myWebView);
webView.loadUrl("file:///android_asset/test.html");
test.html 看起来像:
<html>
<table>
<tr>
<td>
<img src="testimage.png" width="3500px" alt="TestAlt">
</td>
</tr>
</table>
</html>
testimage.png 和 test.html 都在资产中。在我的物理 Android 设备上进行测试后,我得到:
网页不可用 位于 file:///android_asset/test.html 的网页可能暂时关闭,或者它可能已永久移动到新网址。
根据要求提供 Logcat:
I/webclipboard: clipservice: android.sec.clipboard.ClipboardExManager@43ac41b0
V/webkit: BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {43ac3dc8}
D/WebView: loadUrlImpl: called
D/webcore: CORE loadUrl: called
D/webkit: Firewall not null
D/webkit: euler: isUrlBlocked = false
D/chromium: Unknown chromium error: -6
I/GATE: <GATE-M>DEV_ACTION_ERROR</GATE-M>
V/webkit: reportError errorCode(-1) desc(There was a network error)
I/GATE: <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
I/Adreno200-EGLSUB: <ConfigWindowMatch:2136>: Format RGBA_8888.
D/WebView: onSizeChanged - w:480 h:0
D/WebView: onSizeChanged - w:480 h:446
【问题讨论】:
-
你能在这里发布logcat吗
-
@Stacks28 我已按要求更新了我的问题。
-
嘿,你给的路径正确吗?再次检查拼写?
-
@Stacks28 很多很多次...我做了一些研究,以确保我可以正确访问 Android 资产。