How to restrict app to Android phones only

Because of the high densities of new devices such as Nexus 5X, Nexus 6P and the Samsung Galaxy S6 we had to adapt the manifest as following: <compatible-screens> <screen android:screenSize=”small” android:screenDensity=”ldpi” /> <screen android:screenSize=”small” android:screenDensity=”mdpi” /> <screen android:screenSize=”small” android:screenDensity=”hdpi” /> <screen android:screenSize=”small” android:screenDensity=”xhdpi” /> <screen android:screenSize=”small” android:screenDensity=”420″ /> <screen android:screenSize=”small” android:screenDensity=”480″ /> <screen android:screenSize=”small” android:screenDensity=”560″ … Read more

Supporting multiple screen size – Android

I just did something very similar. To stretch the app without creating new layouts I used dimensions set in XML res/values/dimensions.xml res/values-sw600dp/dimensions.xml -> 7+ inches res/values-sw720dp/dimensions.xml -> 10+ inches Dimensions are resources files: <dimen name=”default_padding”>11dp</dimen> You can increase the dimensions by about 30% in the 600 and 720 file. Then simply used @dimen/default_padding in your … Read more

Setting drawable folder to use for different resolutions

How do I force the Nexus to use resources in drawable-xhdpi and then the 10 inch tab to use drawable-xxhdpi? You can’t. The qualifiers hdpi,xhdpi,xxhdpi describes the screen density of the device, not the size of screen. From the official doc Screen density The quantity of pixels within a physical area of the screen; usually … 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

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