android - Different screen sizes? -
i have had trouble in past optimizing app different layouts. told me normal directory override large-land directory, , oddly enough true, deleted normal directory.
will other layouts override each other? have put every layout each of these folders, , edited appropriately (took me week of many hours!), every directory see in picture, has multiple xml resource folders within. need else optimize app layouts? have added following in manifest:
<supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:smallscreens="true" android:xlargescreens="true" />
i don't recommend delete normal directory, because it's used default one.
the utility of normal directory, when system can't find xml file in directory matches device, take default xml (the 1 in normal directory).
this useful if forget add 1 (or more) screen size/orientation directory.
this example:
assuming device belong xlarge category.
scenario 1:
you have these xmls:
(1) res/layout/my_layout.xml // layout normal screen size ("default") (2) res/layout-xlarge/my_layout.xml // layout extra-large screen size (3) res/layout-xlarge-land/my_layout.xml // layout extra-large in landscape orientation in landscape mode, android xml in
res/layout-xlarge-landdirectory => directory exist , containsmy_layout.xmlok, take one.in portrait mode, android xml in
res/layout-xlarge-portdirectory => directory missing, xml inres/layout-xlarge=> directory exist , containsmy_layout.xmlok, take one.
scenario 2: (without layout-xlarge directory)
you have these xmls:
(1) res/layout/my_layout.xml // layout normal screen size ("default") (3) res/layout-xlarge-land/my_layout.xml // layout extra-large in landscape orientation in landscape mode, android xml in
res/layout-xlarge-landdirectory => directory exist , containsmy_layout.xmlok, take one.in portrait mode, android xml in
res/layout-xlarge-portdirectory => directory missing, xml inres/layout-xlarge=> it's missing, xml inres/layout=> directory exist , containsmy_layout.xmlok, take one.
for more details take @ official documentation, in "using configuration qualifiers" section:


Comments
Post a Comment