简体   繁体   English

Android-将资源打包到APK中

[英]Android - Pack resources into apk

Is it possible to pack resources in a way that they get distributed with apk? 是否可以通过apk分发资源的方式打包资源? I know it's impossible to use subfolders in res's directories (drawable, raw, etc)... so I was wondering if I can create folder (data) and somehow tell compiler to include all resources from that folder - and later access them with InputStream (without using R.) 我知道不可能在res的目录(可绘制,原始等)中使用子文件夹...所以我想知道是否可以创建文件夹(数据),并以某种方式告诉编译器包括该文件夹中的所有资源,然后再通过InputStream访问它们(不使用R。)

Thanks! 谢谢!

The only thing I can think of that comes close to fitting your description is to use the assets/ directory in your project. 我能想到的唯一适合您描述的方法是在项目中使用assets/目录。 Everything in there (including subdirectories) gets bundled into the APK and can be accessed at runtime via an AssetManager . 那里的所有内容(包括子目录)都捆绑到APK中,并且可以在运行时通过AssetManager进行访问。

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

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