简体   繁体   English

如何在可绘制文件夹中创建一个新文件夹并从中引用图像?

[英]How to create a new folder inside the drawable folder and reference an image from it?

I am working on an ANDROID project where I have a lot of images and I want to organize it.我正在做一个 ANDROID 项目,我有很多图像,我想组织它。 So I need to create folder inside the drawable folder.所以我需要在可绘制文件夹中创建文件夹。 But I don't know how to reference it in my program.但我不知道如何在我的程序中引用它。

For eg: I have an image named "image.png" and I want to place it in drawable/myicons/image.png or anywhere inside the res folder.例如:我有一个名为“image.png”的图像,我想将它放在 drawable/myicons/image.png 或 res 文件夹内的任何位置。

This is duplicate question 这是重复的问题

You can not create folder inside drawable你不能在drawable里面创建文件夹

the resources mechanism doesn't support subfolders in the drawable directory资源机制不支持可绘制目录中的子文件夹

However you can use the assets folder and have sub directories in there and load images that way.但是,您可以使用 assets 文件夹并在其中有子目录并以这种方式加载图像。

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

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