WebView加載本地html

 

1、加載assets文件夾下html :

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

2、加載手機存儲指定位置下html(sd卡):


webView.loadUrl("file://"+ Environment.getExternalStorageDirectory().getPath()+"/text/index.html");

或者:

webView.loadUrl(file:///mnt/sdcard/test/index.html);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章