[Android]使用WebView加载本地html注意事项

①在java、res同级目录中新建一个assets文件夹;

②在webview的dwebView.getSettings()中加入两个设置:

    dwebView.getSettings().setAllowContentAccess(true);             //  使用本地文件设置
    dwebView.getSettings().setAllowFileAccess(true);

③使用正确的路径访问:

    dwebView.loadUrl("file:///android_asset/index.html");

注意其中的android_asset中没有s


版权声明:本文为weixin_39049564原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。