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.

enter image description here

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-land directory => directory exist , contains my_layout.xml ok, take one.

  • in portrait mode, android xml in res/layout-xlarge-port directory => directory missing, xml in res/layout-xlarge=> directory exist , contains my_layout.xml ok, 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-land directory => directory exist , contains my_layout.xml ok, take one.

  • in portrait mode, android xml in res/layout-xlarge-port directory => directory missing, xml in res/layout-xlarge=> it's missing, xml in res/layout => directory exist , contains my_layout.xml ok, take one.


for more details take @ official documentation, in "using configuration qualifiers" section:


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -