Created
August 3, 2012 03:06
-
-
Save granoeste/3243965 to your computer and use it in GitHub Desktop.
[Android] What Screen layout size?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get screen layout long | |
int long = getResources().getConfiguration().screenLayout | |
& Configuration.SCREENLAYOUT_LONG_MASK; | |
switch (long) { | |
case Configuration.SCREENLAYOUT_LONG_YES: | |
// Long screens, such as WQVGA, WVGA, FWVGA | |
break; | |
case Configuration.SCREENLAYOUT_LONG_NO: | |
// Not long screens, such as QVGA, HVGA, and VGA | |
break; | |
default: | |
break; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @see http://developer.android.com/intl/ja/reference/android/content/res/Configuration.html#screenLayout | |
// get screen layout size | |
int size = getResources().getConfiguration().screenLayout | |
& Configuration.SCREENLAYOUT_SIZE_MASK; | |
switch (size) { | |
case Configuration.SCREENLAYOUT_SIZE_XLARGE: | |
// 720x960 dp units | |
break; | |
case Configuration.SCREENLAYOUT_SIZE_LARGE: | |
// 480x640 dp units | |
break; | |
case Configuration.SCREENLAYOUT_SIZE_NORMAL: | |
// 320x470 dp units | |
break; | |
case Configuration.SCREENLAYOUT_SIZE_SMALL: | |
// 320x426 dp units | |
break; | |
default: | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment