Android webview loadurl("file:///android_asset/index.html#home") 失败 [英] Android webview loadurl("file:///android_asset/index.html#home") failed

查看:29
本文介绍了Android webview loadurl("file:///android_asset/index.html#home") 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Android 中开发一个应用程序,我想在其中使用

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.

您对这个问题有什么想法吗?

Do you have ideas with this issue?

添加一些评论并为我刚才的错误感到抱歉.

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文件夹下

1:First put index.html under www folder

2:将www文件夹放在asset文件夹中,然后调用

2:put the www folder within asset folder and call

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

我认为您可能想在每次运行应用程序时调用 index.html 的 home 选项卡.

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 的主页选项卡设置为活动状态,并使其他选项卡处于非活动状态.

这可能会对您有所帮助.

This will might help you.

这篇关于Android webview loadurl("file:///android_asset/index.html#home") 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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