xmlns:tools="http://schemas.android.com/tools"> //加权限 android:name="androidx.core.content.FileProvider" android:authorities="com.fv.smartbookcase.fileprovider" android:exported="false" android:grantUriPermissions="true"> android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
在res下的xml下创建file_files.xml
WebSettings settings = mWVH5.getSettings();
//允许webview对文件的操作
settings.setAllowUniversalAccessFromFileURLs(true);
settings.setAllowFileAccess(true);
settings.setAllowFileAccessFromFileURLs(true);
// file:///"手机存储的文件路径"
精彩文章
发表评论