I thought the source of our problem was somewhere in the framework code. And of course, I found some clues:
First, if you look inside the TabWidget code , you will see that the label set in setIndicator is passed an inner class called LabelIndicatorStrategy , which takes care of inflating the view associated with the top of the tab. This inflation is done using the xml file tab_indicator.xml . This layout is based on a RelativeLayout containing ImageView and a TextView . And if you look at the properties of textview, you will see that this refers to the style in android styles.xml . And here, finally, you understand that we have IT:
<item name="ellipsize">marquee</item> <item name="singleLine">true</item>
So, now, 2 options:
First, redefine the style by creating your own style, which, in my opinion, will be really painless, and then change these properties to what suits you. Although the result may not be very pleasant. this will require some testing.
Or put on gloves and copy the code from the TabWidget class, because another problem is that the inner class I mentioned is ... PRIVATE, so inheritance is not possible if I'm not mistaken ... So I think a lot more pain than styles.xml. Hope this inspires you, keep me updated on what you get, please. I'm still interested.
Sephy
source share