A general rule for pixel values ββto support multiple screens is based on the basic screen density configuration of your device. The initial density indicator is 160 pixels, mdpi is in this range. Thus, by calculating dpi values, you can put these values ββin different dens.xml to support different devices. General formula:
Result = Value (dpi) * device density (pi) / 160 (dpi)
So, first check the density of your device, and then, according to the above formula, calculate the values ββfor dens.xml. For a standard, we usually assume that:
For density mdpi = 160, hdpi - 240, xhdpi - 320, ldpi - 120
As in your case, if the value is 10 * 10, the result for another screen will be:
For ldpi:
Result = 10 * 120/160 = 7.5, i.e. 7 ppi
For mdpi:
Result = 10 * 160/160 = 10 pixels
For hdpi:
Result = 10 * 240/160 = 15 pixels
For xhdpi:
Result = 10 * 320/160 = 20 pixels
You can also refer to this http://developer.android.com/guide/practices/screens_support.html and http://developer.android.com/training/multiscreen/screendensities.html
Yash
source share