Does anybody know how to set padding between the ActionBar's home icon and the title?
Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.
The Toolbar is basically the advanced successor of the ActionBar. It is much more flexible and customizable in terms of appearance and functionality. Unlike ActionBar, its position is not hardcoded i.e., not at the top of an activity.
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.
EDIT: make sure you set this drawable as LOGO, not as your app icon like some of the commenters did.
Just make an XML drawable and put it in the resource folder "drawable" (without any density or other configuration).
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/my_logo" android:right="10dp"/> </layer-list>
The last step is to set this new drawable as logo in your manifest (or on the Actionbar object in your activity)
Good luck!
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