Is there any way to determine the category of screen size of the current device, such as small, normal, large, xlarge?
Not the density, but the screen size.
Screen-size Buckets Android has included support for three screen-size “buckets” since 1.6, based on these “dp” units: “normal” is currently the most popular device format (originally 320x480, more recently higher-density 480x800); “small” is for smaller screens, and “large” is for “substantially larger” screens.
normal screens are at least ~2.9" x 2" small screens are at least ~2.7" x 2"
You can use the Configuration.screenLayout
bitmask.
Example:
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { // on a large screen device ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With