How do I avoid word wrap and incomplete tab titles ( like the three '...') in Tabs using ViewPager
See screenshot below:
UPDATE
When I set the following in styles.xml:
<style name="MyTabTextStyle" parent="Base.Widget.AppCompat.ActionBar.TabText">
<item name="android:maxLines">1</item>
<item name="android:width">80dp</item>
</style>
it partly works when I DO NOT ADD A LOGO in ActionBarStyle:
<style name="MyActionBarStyle" parent="Widget.AppCompat.ActionBar.Solid">
UPDATE 2 - PROBLEM STILL EXIST WITH LOGO
This is the result, when I use ActionBarStyle
to add a logo
Thank you in advance
The problem is in the width of your
TabText
widget:As you see sometimes 80dp is just enough for your content, but sometimes - it's not. You should avoid using fixed width or height. Instead you can use the
wrap_content
(wide or high enough to fit the content) andmatch_parent
(match the parent size exactly, possibly leaving a lot of "blank space") values.