Question

I want to create Action Bar like this enter image description here

I saw in Dev guide that Action bar icon should be in specific size

is it possible ?

and also is it possible to add item in action bar with no clickable indication ?

Was it helpful?

Solution

i understand your concerns about the action bar icons' size, i had the same, until i discovered this http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html

it's a tool which re-size icons for your whatever you want to add to your app, it also provides few ready cliparts that are ready for use, you just have to click download .zip and you'll get it.

Have fun developing your action bar.

OTHER TIPS

//use your custom xml view to show your customize icons

View actionBarView = getLayoutInflater().inflate(R.layout.action_bar_custom_view, null);
        actionBar.setCustomView(actionBarView);
        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

Yes can do it. But it is good to stick to the icon sizes recommended. As working along with UI guidelines go a long way.

To make your left icon no-clickable, try setHomeButtonEnabled. Since this api is available only on ICS and above and in previous versions icon is enabled by default. So you might have an active icon which does nothing. (Well you can live with this limitation as there are not many 3.x devices)

Custom view is your view so its your wish to make it clickable or not. To add custom view,

mActionBar = getActionBar();
mActionBar.setDisplayShowTitleEnabled(false); // if you dont want title
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
  ActionBar.DISPLAY_SHOW_CUSTOM);
mActionBar.setCustomView(R.layout.action_bar_custom_view);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top