Search code examples
androidlayoutandroid-resourcesqualifiers

Do I have to supply all new resource when using resource qualifier for folder in Android?


Do I have to supply all new resource when using resource qualifier for folder in Android?

I have (originally) folder:

layout

which contains say layout1.xml and layout2.xml.

Then I added folder:

layout-h529dp

Because I want new version of layout1.xml, although I don't want new version of layout2.xml. My question is then -do I really need to supply entirely new complete set of layouts if I add new folder with resource qualifiers? I would like to avoid duplicating xml code. If I remove layout2.xml from layout-h529dp folder then the app seems to crash though, because it can't find layout2.xml from original layout folder.


Solution

  • No you don't have to supply all ressources each time you create a new folder with a qualifier. It would be really annoying.

    When you create your folder layout1.xml inside the folder layout-h529dp it will told the system to use this layout1.xml when a device with h529dp is used. But if you didn't provide a second layout2.xml, no worries, the system will use by default the first one inside folder layout.