Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sub folders in drawable resource folder? [duplicate]

I would like to create sub folders in drawable folder. I have a lot of file(such as png, xml) in drawable folder. I want to create sub folders in there to find the files easily. Can I create sub folders like that?

Thanks.

like image 658
user1156041 Avatar asked May 16 '13 01:05

user1156041


People also ask

Can the Android layout folder contain subfolders?

You can organize your resources XML files (layout, drawable,..) into separate subfolders corresponding to the app's features.

What folder is Drawables directory in?

In Android Studio inside the res folder, one can find the drawable folder, layout folder, mipmap folder, values folder, etc. Among them, the drawable folder contains the different types of images used for the development of the application.

How do I make a drawable Xxhdpi folder?

Simply go to project Explorer and change your View from Android to project from drop Down and you are good to go. There you can simply create folder like we do in Eclipse. And in android project view it is hidden but when you switch to project. You can create folder like drawable-hdpi,drawable-xhdpi .

How to create different layout folder in Android Studio?

For it you must to do some steps: Create Directory in res folder which called layouts . Create Resource Folder in layouts folder which called activity (To create a Resource folder you should choose New -> Folder -> Res Folder, after it write the correct path as example src/main/res/layouts/activity );


1 Answers

This is now (sort of) possible by using Android Studio and Gradle.

Whilst subfolders are still not possible, it is possible to separate resources into different sets and have them merged by the build system.

As an example, to simplify my project, I wanted to keep theme specific drawables separate from standard drawables.

I created a new resource folder named 'res_lighttheme' as illustrated in the picture below.

Folder Structure

I then added a pointer to this folder to my build.gradle file like this. To add more than one just add another line to the definition.

Build Gradle

The result is that BOTH folders are then considered to be valid destinations for resources. A build error will be generated if there is a conflict. i.e if the same resource is included in both folders.

like image 84
Kuffs Avatar answered Sep 20 '22 20:09

Kuffs