【发布时间】:2020-08-01 11:21:46
【问题描述】:
我在 assets 目录中加载 html,这是我的代码:
/home/roroco/Dropbox/jvs/ro-adr/app/src/main/java/ro/adr/test/TestWv.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_wv);
WebView w = (WebView) findViewById(R.id.w);
w.loadUrl("file:///android_asset/test-wv/index.html");
}
我确定这个 html 文件存在
/home/roroco/Dropbox/jvs/ro-adr/app/src/main/assets/test-wv/index.html
【问题讨论】:
-
我不知道 HTML 必须在 /src/main/assets/index.html 中,但您必须将其称为“file:///android_asset/index.html
标签: android