0
votes

As per "android multiple screen design":

"As you design your UI for different screen sizes, you'll discover that each design requires a minimum amount of space. So, each generalized screen size above has an associated minimum resolution that's defined by the system. These minimum sizes are in "dp" units—the same units you should use when defining your layouts—which allows the system to avoid worrying about changes in screen density.

  • xlarge screens are at least 960dp x 720dp
  • large screens are at least 640dp x 480dp
  • normal screens are at least 470dp x 320dp
  • small screens are at least 426dp x 320dp"

DisplayMetrics class gives me access to actual width and height of the screen. However is the above table available programmatically. Or do I need to store these values as constants in my app. The second option seems hacky.

1
The keywords in that are "at least" -- They will change with every device. The DisplayMetrics class will allow you to grab the actual width/height of the device it's running on.Cruceo

1 Answers

0
votes

Your problem is that you try to make a fixed design for x known resolutions whereas Android's Framework is based on the idea that you don't know in advance the exact dimensions of the device your app will be running on. And if you look at the Android market, that's a good assumption to make.

If you make good uses of :
-selectors like "sw600dp"(7" tablet)
-nine-patchs (stretchables assets)
-dimensions in dip for things that need to have a fixed size (for example a button needs to be 48dp at least in order to be big enough)

you can make very good designs that adapt to all form factors from 2" phones to 10" tablets.