Question

I want to declare two different values for a widget, having two test devices:

  • The first has a 480x800 mdpi display
  • The second is 320x480 mdpi

Both are mdpi, but I need a way to name another values-mdpi folder that will contain smaller values for the second device. I tried several names based on this page, but everytime the smaller device assumes the same values of the bigger one. Advices?

Was it helpful?

Solution

So you want to distinguish between different screen sizes, use the smallest width qualifier

http://developer.android.com/training/multiscreen/screensizes.html#TaskUseSWQuali

res/layout-sw600dp //e.g. all tablets that are > 7"

The Smallest-width qualifier allows you to target screens that have a certain minimum width given in dp. For example, the typical 7" tablet has a minimum width of 600 dp, so if you want your UI to have two panes on those screens (but a single list on smaller screens), you can use the same two layouts from the previous section for single and two-pane layouts, but instead of the large size qualifier, use sw600dp to indicate the two-pane layout is for screens on which the smallest-width is 600 dp:

OTHER TIPS

How about a combination of available height & available width, like values-w480dp-h800dp for the 1st one and the normal values-mdpi folder for the latter one?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top