I know there are guidelines for creating icons for specific areas in Android (Tab, List, etc.) and how you would size them according to ldpi, mdpi, hdpi etc.
Are there any rules on how to scale other in-app icons?
I've got a 'tiny' icon of 10x10 px which I am using on my mdpi dev phone, what would be the scaling rules to create ldpi, hdpi & xhdpi versions of that icon?
Thanks
Dave
To resize desktop icons, right-click (or press and hold) the desktop, point to View, then select Large icons, Medium icons, or Small icons.
You must only use the android:roundIcon attribute if you require a different icon asset for circular masks, if for example the branding of your logo relies on a circular shape.
I would create separate images for each one:
Res Px
ldpi 36 x 36
mdpi 48 x 48
hdpi 72 x 72
xhdpi 96 x 96
xxhdpi 144x144
xxxhdpi 192x192
Then just put each of them in the separate stalks of the drawable folder.
The ratios are .75|1|1.33|1.5|2.|3.|4. (or 3:4:6:8:12:16) That is, for your 10x10px bitmap, the graphics would be
ldpi - 10x10 * 0.75 = 7x7
mdpi - 10x10 * 1 = 10x10
tvdpi - 10x10 * 1.33 = 13x13
hdpi - 10x10 * 1.5 = 15x15
xhdpi - 10x10 * 2 = 20x20
xxhdpi - 10x10 * 3 = 30x30
xxxhdpi - 10x10 * 4 = 40x40
Generalized rule for pixel values to support multiple screen is based on a baseline configuration of your device screen density. Baseline for density 160 pixels , mdpi comes in this range. So by calculating dpi values you can put these values in different dimens.xml to support various devices. General formula is :
Result = Value(dpi) * device density(pi)/160(dpi)
So first check your device density first then according to above formula calculate the values for dimens.xml. For standard we generally assume that:
For mdpi density = 160, hdpi - 240, xhdpi - 320 , ldpi - 120
As in your case if value is 10*10 then the Result for different screen will be :
For ldpi:
Result = 10*120/160 = 7.5 , i.e 7 pixels
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
According to the Android-Iconography guide, the icons should follow 2:3:4:6 scale ratios for different screen densities, medium, high, x-high, and xx-high respectively.
You can also check Android Design guide for iconography. http://developer.android.com/design/style/iconography.html
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