Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBarSherlock - Tab Text ellipsize on <Android 3.0 devices

I'm trying to change the tab text of the ActionBarSherlock ActionBar tabs on < Android 3.0 devices.

On devices > Android 3.0 the text simply get wrapped in two lines. On devices < Android 3.0 the text is single line and seems to be set to ellipsize: marquee and marqueeRepeatLimit: marquee_forever.

I'm trying to change this on < Android 3.0 devices to also make the text two lines.

Here is what is try to do:

<style name="MyTheme" parent="@style/Theme.Sherlock">
    <item name="actionBarTabTextStyle">@style/MyActionBarTabTextStyle</item>
</style>

<style name="MyActionBarTabTextStyle" parent="Widget.Sherlock.ActionBar.TabText">
    <item name="android:ellipsize">end</item>
    <item name="android:lines">2</item>
    <item name="android:textColor">#f00</item>
</style>

The textColorattribute is there to make sure that I am even doing the correct thing at all. And yes I am, the tab text is red.

But unfortunately the ellipsize setting doesn't seem to have any effect.

Any ideas on how to change this?

like image 364
Goddchen Avatar asked Nov 04 '22 05:11

Goddchen


1 Answers

Although you probably don't need this anymore (considering the question is more than a year old), there might be someone landing here through a google search and might find this answer useful.

Changing the style to this will make it work:

<style name="MyTheme" parent="@style/Theme.Sherlock">
    <item name="actionBarTabTextStyle">@style/MyActionBarTabTextStyle</item>
    <item name="android:actionBarTabTextStyle">@style/MyActionBarTabTextStyle</item>
</style>

<style name="MyActionBarTabTextStyle" parent="Widget.Sherlock.ActionBar.TabText">
    <item name="android:ellipsize">end</item>
    <item name="android:lines">2</item>
    <item name="android:textColor">#f00</item>
</style>

android:actionBarTabTextStyle represents the TextStyle of the default ActionBar for HC+ and actionBarTabTextStyle the TextStyle for ActionBarSherlock.

like image 69
Ahmad Avatar answered Nov 09 '22 04:11

Ahmad