Action Bar icon size

AndroidIconsAndroid ActionbarActionbarsherlock

Android Problem Overview


According to Action Bar Icons action bar icon for the mdpi screen should be 24 x 24 px but the icons in Action Bar Icon Pack for mdpi are 32 x 32 px. The sizes do not match for other screen sizes neither. So which one is correct and what dimensions should the action bar icon have?

Android Solutions


Solution 1 - Android

-------update 2015.10.17--------

The new google design gideline says:"System icons are displayed at 24dp","Icon content is limited to the 20 x 20dp live area, with 4px of trim around the perimeter".Like:

enter image description here ------old-------

Full asset, 32x32 dp; Optical square, 24x24 dp

enter image description here

Solution 2 - Android

UPDATE: this answer is no longer valid, see the below answer for more up-to-date guidelines.

I believe they have to be 32x32dp, but the actual image itself should be 24dpx24dp centred. The Android design website has the correct guidelines.

I've submitted a bug report about this but have yet to hear anything...

Solution 3 - Android

I've conducted more testing with AppCompat ActionBar. I found out, that the ActionBar takes care for itself to enforce the minimum 48dp touch target size. I also found out, that the AppCompat ActionBar still expects action bar icons with a 32dp square size.

Even with Material design, icons still have to follow rule "Full asset: 32x32 dp; Optical square: 24x24 dp" to have the correct size along with other icons in the action bar as this figure (from wangqi060934's anwer) shows:

enter image description here

My previous assumption (see figures below) that the full asset size expanded from 32dp to 48dp is not correct. The 48dp are talking about the touch area. The confusion was caused by the revised Material Icon Spec document which is linked in the much older ActionBar document.

enter image description here

from https://www.google.com/design/spec/style/icons.html#icons-system-icons

enter image description here

from http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylines-sizing-by-increments

Solution 4 - Android

Use Android Studio Image Asset

Go to:

  1. Project>res --> right click
  2. new> image asset --> Icon type: Action Bar and Tab Icons
  3. next>Finish.

Now you will have your icon in the correct resolutions.

Solution 5 - Android

The finished action bar icon dimensions as shown in the link below should be. https://developer.android.com/guide/practices/ui_guidelines/icon_design_action_bar.html

Low density screen

ldpi (120 dpi) --> 18 x 18 px

Medium density screen

mdpi (160 dpi) --> 24 x 24 px

High density screen

hdpi (240 dpi) --> 36 x 36 px

Extra-high density screen

xhdpi (320 dpi) --> 48 x 48 px	

XX-high density screen

xxhdpi (480 dpi) --> 72 x 72 px

XXX-high density screen

xxxhdpi (640 dpi) --> 96 x 96 px

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGiorgiView Question on Stackoverflow
Solution 1 - Androidwangqi060934View Answer on Stackoverflow
Solution 2 - AndroidAlex CurranView Answer on Stackoverflow
Solution 3 - AndroidOneWorldView Answer on Stackoverflow
Solution 4 - AndroidCarLoOSXView Answer on Stackoverflow
Solution 5 - AndroidRadoslavView Answer on Stackoverflow