1

What are standard 4 android screen sizes ? are they ?

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

how can I get the these widths using the code ?

Adham
  • 63,550
  • 98
  • 229
  • 344
  • 1
    Do you want to get all four, or do you want the know the screen size of the device the app is running on? – Neil Townsend Jul 12 '13 at 09:20
  • You should take a link at this [Android designing for multiple screen sizes](http://developer.android.com/training/multiscreen/index.html) – Mazvél Jul 12 '13 at 09:20

2 Answers2

5

Very usefull link: ScreenSize Overview

The definitions are:

  • large screens are at least 640dp x 480dp.
  • normal screens are at least 470dp x 320dp.
  • small screens are at least 426dp x 320dp. (Android does not currently support screens smaller than this.)

Here are some more examples of how this works with real screens:

  • A QVGA screen is 320x240 ldpi. Converting to mdpi (a 4/3 scaling factor) gives us 426dp x 320dp; this matches the minimum size above for the small screen bucket.
  • The Xoom is a typical 10” tablet with a 1280x800 mdpi screen. This places it into the xlarge screen bucket.
  • The Dell Streak is a 800x480 mdpi screen. This places it into the bottom of the large size bucket.
  • A typical 7” tablet has a 1024x600 mdpi screen. This also counts as a large screen.
  • The original Samsung Galaxy Tab is an interesting case. Physically it is a 1024x600 7” screen and thus classified as “large”. However the device configures its screen as hdpi, which means after applying the appropriate ⅔ scaling factor the actual space on the screen is 682dp x 400dp. This actually moves it out of the “large” bucket and into a “normal” screen size. The Tab actually reports that it is “large”; this was a mistake in the framework’s computation of the size for that device that we made. Today no devices should ship like this.
Oli
  • 3,496
  • 23
  • 32
1

It depends of what you are trying to achieve... If you want to have a specific layout for a specific screen size, you can create a new folder called layout-large, for example. See the android developers guide.

If you want to get the actual screen size programmatically, then you can use this :

int screenSize = getResources().getConfiguration().screenLayout &
    Configuration.SCREENLAYOUT_SIZE_MASK;

See this answer.

Community
  • 1
  • 1
Matthieu Harlé
  • 739
  • 1
  • 13
  • 32