Android: How to change the ActionBar Home Icon to be something other than the app icon?
The ActionBar will use the android:logo attribute of your manifest, if one is provided. That lets you use separate drawable resources for the icon (Launcher) and the logo (ActionBar, among other things).
Show both app icon and back arrow in ActionBar in Android App
Try this.
I tested and It works.
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(getResources().getDrawable(R.drawable.ic_launcher));
getSupportActionBar().setDisplayUseLogoEnabled(true);
EDIT
getSupportActionBar().setTitle("Your Actionbar Title");
How to change option menu icon in the action bar?
The following lines should be updated in app -> main -> res -> values -> Styles.xml
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>
<!-- Style to replace actionbar overflow icon. set item 'android:actionOverflowButtonStyle' in AppTheme -->
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">
<item name="android:src">@drawable/ic_launcher</item>
<item name="android:background">?android:attr/actionBarItemBackground</item>
<item name="android:contentDescription">"Lala"</item>
</style>
This is how it can be done. If you want to change the overflow icon in action bar
Changing the Action bar icon
getActionBar();
You're throwing the action bar away right there. getActionBar()
returns an instance of ActionBar
, which you then need to call setIcon()
on. Like so:
ActionBar actionBar = getActionBar();
actionBar.setIcon(R.drawable.my_icon);
Related Topics
When Exactly Are Onsaveinstancestate() and Onrestoreinstancestate() Called
Filter Output in Logcat by Tagname
Change Status Bar Color with Appcompat Actionbaractivity
Using JSON File in Android App Resources
Should I Use Android: Process =":Remote" in My Receiver
Position of Dialogfragment in Android
Android Studio Unit Testing: Read Data (Input) File
Padding Between Actionbar's Home Icon and Title
Login Error: There Is an Error in Logging You into This Application. Please Try Again Later
How to Embed a Custom Font in an Android Application
Access Pictures from Pictures App in My Android App
Android Toolbar Adding Menu Items for Different Fragments
Android - Apply Selectableitembackground in Xml with Support V7