I am using ActionBar Sherlock library. So, to change the default home button. I did this:
<style name="Theme.mTheme" parent="android:Theme.Sherlock.Light.DarkActionBar">
<item name="android:homeAsUpIndicator">@drawable/custom_home</item>
</style>
which didn't work
So, i added this too:
<item name="homeAsUpIndicator">@drawable/custom_home</item>
now its working. I am having this custom home icon/button on every ActionBar. But in 1 of my Activities i have this in code:
actionBar.setIcon(R.drawable.options_holo_dark);
When i am in that Activity, I can see the icon which i set programatically ie.., options_holo_dark. The 1 which i set in Theme ie.., custom_home is not visible. But the Icon has moved to the Right as if its giving space on the left to the icon i set in theme(though not visible).
This is what i am getting now:
So, how can i avoid that empty space on the left side of the Home Icon?
Thank You
Theme item android:homeAsUpIndicator
(and homeAsUpIndicator
for ActionBarSherlock
) sets drawable for the up icon - that's the little arrow pointing to left that is displayed next to the app icon when you have called setDisplayHomeAsUpEnabled(true)
on the action bar.
The size of the up drawable defines the left margin for the app icon (logo). By default its dimensions are 16dp x 16dp. If you put there wider drawable the gap between edge of the screen and the app icon would be wider even though the up icon is not displayed at the moment.
If you want to change the app icon (logo). Use setLogo(int)
or setLogo(Drawable)
method of ActionBar
. Don't forget to call setDisplayUseLogoEnabled(true)
too - this method toggles between displaying app icon and custom logo. Also you can define the logo in manifest in attribute android:logo
of <application>
and <activity>
tags and set in theme that you want to use logo instead of app icon in the action bar.
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