Skip to content

Instantly share code, notes, and snippets.

@sakurabird
Created November 18, 2013 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakurabird/7523039 to your computer and use it in GitHub Desktop.
Save sakurabird/7523039 to your computer and use it in GitHub Desktop.
screen size 表示
int screenSize = getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch (screenSize) {
case Configuration.SCREENLAYOUT_SIZE_LARGE:
Utils.showToast("Large screen");
break;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
Utils.showToast("Normal screen");
break;
case Configuration.SCREENLAYOUT_SIZE_SMALL:
Utils.showToast("Small screen");
break;
case Configuration.SCREENLAYOUT_SIZE_XLARGE:
Utils.showToast("xlarge screen");
break;
default:
Utils.showToast("Screen size is neither large, xlarge, normal or small");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment