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 toGoogleMusicAdapter. 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:That did it for me.