device - Android: Values priority -


in app in res folder, there values folders different devices. example:

values-mdpi
values-hdpi
values-v14
values-v17
values-w480
values-w720

etc.

i wonder priority of these folders android?

let's imagine couple devices:

first : 480*800  hdpi v14   second: 320*480  mdpi v17   third : 720*1280 hdpi v17   

what folder android use each of them?

you can find priority of resource folders here in page. used support different devices , configurations.

android uses logic determine best possible matching resource folder device. explained in this documentation page.

regarding devices query:

  • first: 480 * 800 hdpi v14 -- values-hdpi
  • second: 320 * 480 mdpi v17 -- values-mdpi
  • third: 720 * 1280 hdpi v17 -- values-w480

in list provided you, values-w480 (devices lowest width of 480dp, api 13) has got highest merit. whichever device meets criteria, it'll take resources folder.

the values-vxx (devices api >= xx) has got lowest merit. if other folders not taken, android takes resources folder. check table listing resources qualifiers more info on topic. resource qualifiers listed in table in order of precedence of resource qualifiers.

  • first case: normal hdpi - less 480dp width -- values-hdpi
  • second case: normal mdpi - less 480dp width -- values-mdpi (values-mdpi has got more weightage values-v17)
  • third case: hdpi device width of 480dp (720/1.5 = 480) api 17 -- values-w480

Comments