Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Organise Layouts into Sub Folders

Tags:

android

layout

I have a fairly complex android app, the contents of the 'layout' folder is becoming increasingly large. I've tried to organise the individual layout xml files into sub folders e.g. layout/buttons/, layout/activity/, layout/views/ etc. This doesn't seem to work, the content of the folders in not parsed into the R. class.

Is there a way to do this?

Thanks!

like image 256
longhairedsi Avatar asked Dec 31 '10 16:12

longhairedsi


People also ask

Can the Android layout folder contain subfolders?

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).

How do I create a layout folder?

Select layouts , right-click and select New → Folder → Res Folder. This resource folder will represent a “feature category” that you want. You can easily create any type of file/folder in Android Studio.

How do I create a subfolder on my phone?

Access the home screen panel where the apps you want to put into a folder are located. Drag the first app and drop it on top of another and this will create a folder with both apps inside.

Where are the layout files placed in Android?

Layout files are stored in "res-> layout" in the Android application. When we open the resource of the application we find the layout files of the Android application. We can create layouts in the XML file or in the Java file programmatically. First, we will create a new Android Studio project named "Layouts Example".


1 Answers

I don't think you're going to be able to do this. I believe that it only supports certain folder names like layout-large, layout-mdpi, layout-hdpi, layout-fr, etc. You can use more than one of these modifies as well like layout-fr-hdpi-large.

This page shows all of the allowed modifiers

http://developer.android.com/guide/topics/resources/providing-resources.html

like image 170
FoamyGuy Avatar answered Oct 02 '22 16:10

FoamyGuy