现在,我在'res/layout'文件夹内存储每个XML布局文件,因此管理小型项目是可行和简单的,但当有大型和繁重的项目的情况下,那么应该有一个层次结构和子文件夹内需要的布局文件夹。
如。
layout
-- layout_personal
-- personal_detail.xml
-- personal_other.xml
--layout_address
-- address1.xml
-- address2.xml
同样,我们希望大型应用程序有子文件夹,那么在Android项目中有办法做到这一点吗?
我能够在布局文件夹内创建layout-personal和layout_address子文件夹,但当需要使用R.layout访问XML布局文件时。_______,当时在菜单中没有任何XML布局弹出。
答案是否定的。
我想提请您注意这本书Pro Android 2,它指出:
It is also worth noting a few
constraints regarding resources.
First, Android supports only a linear
list of files within the predefined
folders under res. For example, it
does not support nested folders under
the layout folder (or the other
folders under res).
Second, there are some similarities
between the assets folder and the raw
folder under res. Both folders can
contain raw files, but the files
within raw are considered resources
and the files within assets are not.
Note that because the contents of the
assets folder are not considered
resources, you can put an arbitrary
hierarchy of folders and files within
it.
答案是否定的。
我想提请您注意这本书Pro Android 2,它指出:
It is also worth noting a few
constraints regarding resources.
First, Android supports only a linear
list of files within the predefined
folders under res. For example, it
does not support nested folders under
the layout folder (or the other
folders under res).
Second, there are some similarities
between the assets folder and the raw
folder under res. Both folders can
contain raw files, but the files
within raw are considered resources
and the files within assets are not.
Note that because the contents of the
assets folder are not considered
resources, you can put an arbitrary
hierarchy of folders and files within
it.