I am making an android application which has an actionbar and the actionbar contains the menu items on both sides. So, I need to add one menu item at left side and one menu item at right side of the actionbar.
For this i have created a custom layout and set it to the action bar. As shown in the below image
but i just want to have menu items at the places of left side and right the other screenshot shows the action bar with menu items
In this the actionbar contains the menu items. So, i just want the put the plus button menu item to the left as same the first screen shot but i dont want to use the custom layout for this,
Also i need to chnage the font style of the actionbar title and put it in center.
Please help me. I spent many hours on this.
Thank You
This example demonstrate about how to create a custom action bar in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
An Action bar is traditionally a part of an Activity opaque window decor controlled by the framework but a Toolbar may be placed at any level of nesting within a view hierarchy. The toolbar provides more feature than ActionBar . A Toolbar may contain a combination of elements from start to end.
You can directly add navigation drawable to your toolbar try this code :
yourToolbar.setNavigationIcon("Resource id")
yourToolbar.setNavigationOnClickListener(new ClickListener(){})
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