简体   繁体   English

Android 11 上的 WebView - 不显示本地图像文件

[英]WebView on Android 11 - not showing local image files

I have a problem with WebView on Android 11 (this worked under Android 10).我对 Android 11 上的 WebView 有问题(这在 Android 10 下工作)。 The html html

<img src='file:///storage/emulated/0/Android/data/<package>/image_cache/item_15.bmp'>

does not load the image.不加载图像。 That html is part of a larger string. html 是更大字符串的一部分。 The image file was created by the same app and is valid.图像文件是由同一个应用程序创建的,并且是有效的。

What's changed?有什么改变?

Try setting webview.getSettings().setAllowFileAccess(true);尝试设置webview.getSettings().setAllowFileAccess(true); . . The documentation says: 文档说:

The default value is true for apps targeting Build.VERSION_CODES.Q and below, and false when targeting Build.VERSION_CODES.R and above.面向 Build.VERSION_CODES.Q 及更低版本的应用默认值为 true,而面向 Build.VERSION_CODES.R 及更高版本的应用默认值为 false。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM