I am trying to get the tab text to display in 2 lines using the in ViewPagerIndicator using the "Sample Styled Tabs" example. Here's what I have done so far:
In SampleTabsStyled.java
, I made the following change to GoogleMusicAdapter
. Notice the new line character I added to the title string:
@Override
public CharSequence getPageTitle(int position) {
StringBuilder sb = new StringBuilder(CONTENT[position % CONTENT.length].toUpperCase());
sb.append("\n");
sb.append(RANDOM.nextInt(1000));
return sb.toString();
}
In styles.xml
, I made the following change:
<style name="CustomTabPageIndicator.Text" parent="android:TextAppearance.Medium">
<item name="android:typeface">monospace</item>
<item name="android:singleLine">false</item>
</style>
However, I only see the first line of text in the VPI tabs. I don't see the second line of numbers. What might I be doing wrong?
I found the answer with help on G+. Here's what I had to do:
CustomTabPageIndicator.Text
. I reverted it to the original.Add the following line to the style for CustomTabPageIndicator
:
<item name="android:maxLines">2</item>
That did it for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With