更新时间:2023-02-23 21:13:16
没有资产文件夹中存在的文件的绝对路径".您项目的 assets/
文件夹的内容打包在 APK 文件中.使用 AssetManager
对象来获取资产上的 InputStream
.
There is no "absolute path for a file existing in the asset folder". The content of your project's assets/
folder are packaged in the APK file. Use an AssetManager
object to get an InputStream
on an asset.
对于WebView
,您可以像使用URL 一样使用file
Uri
方案.资产的语法是 file:///android_asset/...
(注意:三个斜杠),其中省略号是 assets/
文件夹中的文件路径.
For WebView
, you can use the file
Uri
scheme in much the same way you would use a URL. The syntax for assets is file:///android_asset/...
(note: three slashes) where the ellipsis is the path of the file from within the assets/
folder.