Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android layouts under subfolders

Tags:

android

layout

Is it possible to create subfolders under res/layout and place the layout XML files there so that one can call a view like setContentView(R.layout.questions.create); or setContentView(R.layout.questions/create); ?

like image 538
Mithun Sreedharan Avatar asked Nov 18 '10 04:11

Mithun Sreedharan


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). Second, there are some similarities between the assets folder and the raw folder under res.

Can you create subfolders in Android?

To create a subfolder, tap the menu button > Create subfolder: Once you create a subfolder, you can start adding files to it.

What is a layout folder?

Normally we store every xml layout file inside the res/layout folder. It is feasible and simple to manage small projects. But in a large and heavy project, it is very common that the resources folder grows and grows and if your project have more then 35 layouts it's a problem to find a required layout.


1 Answers

From my tests, no.

You might want to consider a naming convention:

  • questions_create
  • questions_list
  • answers_list

Or, investigate Android library projects: http://androidblogger.blogspot.com/2010/09/android-library-projects.html - seems pretty good to add more structure.

like image 163
Sebastian Roth Avatar answered Sep 29 '22 21:09

Sebastian Roth