android - 在 android 中使用本地网站 (html)

标签 android web offline

我想在我的 Android 应用程序中添加一个网站,我想要一个不使用网络伺服器的离线导航。 我的意思是,当我点击该网站时,它将在没有互联网的情况下打开。是否可以 ? 谢谢

最佳答案

好的,那么: 首先将您需要加载的 html、css、js 或其他文件放在同一个文件夹中以执行“简单方法”,但如果您愿意,可以为每个文件使用不同的路径。

加载网页:

    urlcapitulo = "file:///android_asset/youweb.html";  //change for you html file

   web = (WebView) findViewById(R.id.webkit);  //using webview declare in xml
   web.getSettings().setJavaScriptEnabled(true); // enable javascript
   web.getSettings().setBuiltInZoomControls(true); // add zoom button

  web.loadUrl(urlcapitulo); // load url  

关于android - 在 android 中使用本地网站 (html),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29638862/

相关文章:

android - 为网站构建 Android 应用程序

html - 是否可以使用本地存储运行*完全*客户端、基于 HTML5 的应用程序?

java - gradle 类转换异常 : cannot cast to 'java.lang.iterable'

android - 香气安装程序问题

java - 错误: method verifyCredentials in interface AccountService cannot be applied to given types

java - 如何公开本地部署的Web服务

linux - 配置 Apache 以允许禁止目录列表

带有子存储库和离线克隆的 Mercurial 工作流程?

html - HTML5 离线应用程序是否需要 swapCache()?

android - 通过Graph API评论文章时"OAuthException - An unknown error has occurred"