Reputation: 8028
I want to create Action Bar like this
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 ?
Upvotes: 4
Views: 6659
Reputation: 668
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.
Upvotes: 3
Reputation: 9590
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);
Upvotes: 1
Reputation: 20031
//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);
Upvotes: 2