在绘制资源文件夹的子文件夹? [英] Sub folders in drawable resource folder?

查看:228
本文介绍了在绘制资源文件夹的子文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建绘制文件夹的子文件夹。我有很多的文件(如PNG,XML)的绘制文件夹中。我想在那里创建子文件夹,以方便地查找文件。我可以创建子文件夹,这样呢?

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?

感谢。

推荐答案

这是现在(在某种程度上)可以通过采用Android Studio和摇篮。

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.

我创建了一个名为res_lighttheme的新资源文件夹如下面的图片。

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

然后添加一个指向此文件夹这样我build.gradle文件。要添加多个只需添加另一条线路的定义。

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.

其结果是,这两个文件夹,然后被认为是对资源的有效目的地。如果有冲突会产生生成错误。即,如果相同的资源被包括在这两个文件夹

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.

这篇关于在绘制资源文件夹的子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆