简体   繁体   English

资产——“图像”、“声音”和“webkit”?

[英]Assets - “images”, “sounds”, and “webkit”?

I am trying to get recursively load all the assets I have placed within the "assets" folder within my project.我正在尝试以递归方式加载我放置在项目“资产”文件夹中的所有资产。 When I do the following:当我执行以下操作时:

AssetManager assetManager = getResources().getAssets();
String assets[] = assetManager.list("");

and the check what strings were loaded into the assets array, I find the assets I have placed within the specified folder, along with the strings "images", "sounds", and "webkit".并检查哪些字符串被加载到资产数组中,我找到了我放置在指定文件夹中的资产,以及字符串“images”、“sounds”和“webkit”。 Does anyone know why this is?有人知道为什么吗?

For background information (don't yet know if it is applicable), my assets are zip files that contain complete html webpages, which I use to load into WebViews.对于背景信息(还不知道它是否适用),我的资产是 zip 文件,其中包含完整的 html 网页,我用来加载到 WebViews。

I also have noted this.我也注意到了这一点。 Here are some assets that are placed in those directories:以下是放置在这些目录中的一些资产:

webkit/play.png
webkit/nullPlugin.png
webkit/missingImage.png
webkit/android-weberror.png
sounds/bootanim1.raw
images/comobox-disabled.png
images/comobox-noHighlight.png 

My guess is that system relies on this assets to be present in all.apk files.我的猜测是系统依赖这些资产存在于 all.apk 文件中。 But instead of building them in (which would increase size of all.apk files), Android emulates them via asset API.但是,Android 不是在其中构建它们(这会增加 all.apk 文件的大小),而是通过资产 API 模拟它们。

Also, as a side-effect, you can override this assets with any custom asset that has same name as built-in one.此外,作为副作用,您可以使用与内置资产同名的任何自定义资产覆盖此资产。 Not that this may be too useful, but this is possible.并不是说这可能太有用,但这是可能的。

i had this problem and i suggest you check couple of things:我有这个问题,我建议你检查几件事:

  1. the directory name is written in english.目录名称是用英文写的。 \n \n
  2. you have just one directory in your assets root (in this one directory you can insert couple of drectories).您的资产根目录中只有一个目录(在这个目录中您可以插入几个目录)。
    for example:例如:
    assets->app->image , assets->app->another dir. assets->app->imageassets->app->another目录。
    in this example the app dir is the only dir in the asssete root.在此示例中,应用程序目录是资产根目录中的唯一目录。

In my case, I was creating the assets folder inside the "app" directory of the project (app -> assets), and the files I loaded into this "assets" folder were not being read by the AssetsManager.在我的例子中,我在项目的“app”目录(app -> assets)中创建了 assets 文件夹,而 AssetsManager 没有读取我加载到这个“assets”文件夹中的文件。 Then I right clicked on the "app" folder -> New -> Folder -> Assets Folder (location "main") and everything was resolved.然后我右键单击“应用程序”文件夹->新建->文件夹->资产文件夹(位置“主”),一切都解决了。 The problem was with the location where the "assets" folder was being created.问题在于创建“资产”文件夹的位置。

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

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