ActionBar custom title as ImaveView instead of TextView
android, android-actionbar, customization
Solution
if you want an image, you can specify the app logo along with the icon (it will be used instead of icon):
<application
android:icon="@drawable/ic_launcher"
android:logo="@drawable/logo"
android:label="@string/app_name"
android:name=".AppName"
>
Now you have an arbitrary image instead of your lanucher icon. What you need to do next is to get rid of the text. In your styles do something like:
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="titleTextStyle">@style/NoTitleText</item>
<item name="android:titleTextStyle">@style/NoTitleText</item>
<item name="subtitleTextStyle">@style/NoTitleText</item>
<item name="android:subtitleTextStyle">@style/NoTitleText</item>
</style>
<style name="NoTitleText">
<item name="android:textSize">0sp</item>
<item name="android:textColor">#00000000</item>
</style>
You should use both `item name="titleTextStyle"` and `item name="android:titleTextStyle"` if you use ActionBarSherlock if I remember well.
Problem
I've trying to work around this on the actionbar but from What I can see the title is basicly a TextView but I need to place an image instead of plain text. I try to set it up into the Style themes.xml as this: ``` <item name="android:actionBarStyle">@style/MyActionBar</item> ``` And then I defined this style ``` <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> <item name="android:background">@drawable/action_background</item> <item name="android:titleTextStyle">@style/ActionbarTitleStyle</item> </style> ``` I thought that I could defined the background for the title but even If I do is not what I want, try the getActionBar().setCustomView(layout); but happend that my actionbar is null before the setContentView is being called and I need it in a Base class. PD. I only need to care about HONEYCOMB and Higher, so if you please not suggest Sherlock or Jonhanilson implementations.