I have been able to customize the action bar\'s background, logo image and text color using suggestions from these:
Android: How to change the ActionBar "Home"
If you are using Toolbar, you don't need those solutions. You only have to change the theme of the toolbar
app:theme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
If you are using a dark.actionBar your back button is going to be white else if you are using light actionbar theme it is going to be black.
I did the below code onCreate()
and worked with me
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_yourindicator);
tray this:
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close);
inside onCreate()
;
So you can change it programmatically easily by using homeAsUpIndicator() function that added in android API level 18 and upper.
ActionBar().setHomeAsUpIndicator(R.drawable.ic_yourindicator);
If you use support library
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_yourindicator);
I had the same issue of Action-bar Home button icon direction,because of miss managing of Icon in Gradle Resource directory icon
like in Arabic Gradle resource directory you put icon in x-hdpi and in English Gradle resource same icon name you put in different density folder like xx-hdpi ,so that in APK there will be two same icon names in different directories,so your device will pick density dependent icon may be RTL or LTR
I used back.png image in the project menifest.xml file. it is fine working in project.
<activity
android:name=".YourActivity"
android:icon="@drawable/back"
android:label="@string/app_name" >
</activity>