android-screen-support
Android resource selection layout- and values- inconsistencies
I’m sure you’re dealing with resource precedence used for selection. If you provide folders: layout-sw600dp-* values-large-* values-sw600dp-* Android is not obliged to match values selection folder to those of layout, rather it uses same precedence logic separately for layout and separately for values folder. You can learn about this selection algorithm here: http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch
Do I need 14 different layouts to support all Android devices?
Your app will work on 100% of the devices with the classic layout. You can just add some buttons or change the layout in landscape mode by adding some qualifiers but that’s up to you! For instance, on LDPI (small resolution) device, you may want to adjust some buttons or change a little bit to … Read more
Scale factor for xxhdpi android?
In android.util.DisplayMetrics, you can see that scaling factor is 0.00625: /** * Scaling factor to convert a density in DPI units to the density scale. * @hide */ public static final float DENSITY_DEFAULT_SCALE = 1.0f / DENSITY_DEFAULT; Where as DENSITY_DEFAULT is 160 –> scaling factor = 1.0f / 160 = 0.00625. sizeScale = DENSITY_DEFAULT_SCALE * … Read more
About Android image and asset sizes
mdpi is the reference density — that is, 1 px on an mdpi display is equal to 1 dip. The ratio for asset scaling is: ldpi | mdpi | tvdpi | hdpi | xhdpi | xxhdpi | xxxhdpi 0.75 | 1 | 1.33 | 1.5 | 2 | 3 | 4 Although you don’t really … Read more
How to define dimens.xml for every different screen size in android?
You have to create Different values folder for different screens . Like values-sw720dp 10.1” tablet 1280×800 mdpi values-sw600dp 7.0” tablet 1024×600 mdpi values-sw480dp 5.4” 480×854 mdpi values-sw480dp 5.1” 480×800 mdpi values-xxhdpi 5.5″ 1080×1920 xxhdpi values-xxxhdpi 5.5″ 1440×2560 xxxhdpi values-xhdpi 4.7” 1280×720 xhdpi values-xhdpi 4.65” 720×1280 xhdpi values-hdpi 4.0” 480×800 hdpi values-hdpi 3.7” 480×854 hdpi values-mdpi … Read more
How to determine device screen size category (small, normal, large, xlarge) using code?
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 … }