Webview从资源目录加载html我正在尝试从assets目录加载一个html页面。我尝试了这个,但它失败了。public class ViewWeb extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView wv;
wv = (WebView) findViewById(R.id.webView1);
wv.loadUrl("file:///android_asset/aboutcertified.html"); // fails here
setContentView(R.layout.webview);
} }我在LogCat中没有任何明显的错误...
3 回答
忽然笑
TA贡献1806条经验 获得超5个赞
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView wb = new WebView(this); wb.loadUrl("file:///android_asset/index.html"); setContentView(wb); }keep your .html in `asset` folder
- 3 回答
- 0 关注
- 407 浏览
添加回答
举报
0/150
提交
取消