Amit Pal Amit Pal - 1 year ago 295
Android Question

How to define dimens.xml for every different screen size in android?

When we talked about supporting different screen size in

. Everyone is focusing on creating different layouts for every possible screens i.e.

  • ldpi

  • mdpi

  • hdpi

  • xhdpi

  • xxhdpi

  • xxxhdpi

What I did is design a layout as per
screen reference and define it's
. Now I want to give support it to every possible
screen size. How can I do that?

As far as I know, I can use this tool to figure out the proper
for other screen size and add to my project. Is this the right way to do it in my situation?

Another question is Do I only need to create
for above screen dimensions? If yes then what is

Thanks for your help. I only want to give support to
not tablet and other devices.

Answer Source

You have to create Different values folder for different screens . Like

values-sw720dp          10.1” tablet 1280x800 mdpi

values-sw600dp          7.0”  tablet 1024x600 mdpi

values-sw480dp          5.4”  480x854 mdpi 
values-sw480dp          5.1”  480x800 mdpi 

values-xhdpi            4.7”   1280x720 xhdpi 
values-xhdpi            4.65”  720x1280 xhdpi 

values-hdpi             4.0” 480x800 hdpi
values-hdpi             3.7” 480x854 hdpi

values-mdpi             3.2” 320x480 mdpi

values-ldpi             3.4” 240x432 ldpi
values-ldpi             3.3” 240x400 ldpi
values-ldpi             2.7” 240x320 ldpi

enter image description here

For more information you may visit here

Different values folders in android

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download