How can i make the buttons with text,with images in action bar like below.
Is it possible to use Inbuilt android button or image button to do like below in action bar.
I am using appcompat to use action bar.
From the Menu bar, click View > Toolbars > Customize. The Customize dialog and toolbar must be is displayed to perform this action. From the source toolbar to move the icon from, drag the icon holding down the mouse button to the target toolbar. Repeat for each icon to move.
Yes, you can inflate a custom actionbar if you need.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LayoutInflater inflater = (LayoutInflater) getActionBar()
.getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View customActionBarView = inflater.inflate(R.layout.actionbar_custom, null);
ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(
ActionBar.DISPLAY_SHOW_CUSTOM,
ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME
| ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setCustomView(customActionBarView,
new ActionBar.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
setContentView(R.layout.activity_main);
}
Where actionbar_custom.xml would be your layout resource, usually a LinearLayout with whatever components you want.
You mean action items?http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems
You need to create a menu layout, as the guide mentioned above describes.
The default icon set for Android could be found here: http://developer.android.com/design/downloads/index.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