Define custom Logo for ActionBar (different than Logo) in XML?
Just set a value for the android:icon attribute
<style name="AppTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarStyle">@style/AppTheme.ActionBarStyle</item></style><style name="AppTheme.ActionBarStyle" parent="android:style/Widget.Holo.Light.ActionBar"> <item name="android:background">@drawable/actionbar_background</item> <item name="android:titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item> <item name="android:icon">@drawable/ic_home</item> <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item></style>
You don't style the logo in the your style XML, you simply use android:logo
in your Manifest, then use setDisplayUseLogoEnabled()
to set it in the ActionBar
. Here's a project, from Google, that shows you how to switch between the two. http://code.google.com/p/styled-action-bar/
Sounds like you need to use a custom layout for the action bar, that way you can define a whatever you want for logo image.
Action bar / ActionbarSherlock style
<style name="ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"> <item name="displayOptions">showCustom</item> <item name="android:displayOptions">showCustom</item> <item name="customNavigationLayout">@layout/action_bar_home_icon_default</item> <item name="android:customNavigationLayout">@layout/action_bar_home_icon_default</item> </style>
@layout/action_bar_home_icon_default is your custom layout, with your custom logo