机器人的WebView使用loadURL("文件:///android_asset/index.html#home")失败机器人、文件、QUOT、loadURL

2023-09-07 11:08:46 作者:洫色蒗澷

我的工作在Android中,在这里我想用加载本地HTML文件的应用程序

I am working on an application in Android, where I want to load a local html file using

webview.loadurl("file:///android_asset/index.html#home");

这将加载确定的大多数设备,但在一些三星设备与Android OS 4.0.4,它加载失败。

It will load ok on most devices, but on some Samsung devices with Android OS 4.0.4 , it load fails.

你有想法有这个问题?

添加了一些意见和对不起我的错误刚才。

Add some comments and sorry for my mistake just now.

webview.loadurl("file:///android_asset/www/index.html");

工作正常,但

webview.loadurl("file:///android_asset/www/index.html#home");

失败。

推荐答案

首先检查 index.html的是在资源文件夹中的项目文件夹。

First check that index.html is under asset folder in your project folder.

我相信这是在 WWW 项目的资源文件夹中的文件夹。

I believe it is under www folder within asset folder of your project.

1:先放 index.html的在 WWW 文件夹

2:把 WWW 文件夹内的资产文件夹,并调用

2:put the www folder within asset folder and call

webview.loadurl("file:///android_asset/www/index.html");

编辑:

我想你可能要调用的主页的index.html的每一次标签时,你会运行应用程序。

I think you might want to call the home tab of the index.html every-time when you will run the application.

由于Android是HTML页面的唯一关心的不是这里的标签是可以帮助你,即一个好办法

As android is only concern of the html pages not the tabs here is a good way which may help you i.e.

设置主页选项卡处于活动状态的index.html和进行其他活动的。

这将可能会帮助你。