我想在我的 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/