4

enter image description here I wrote Videos but in tab it is coming as VIDEOS all in capitals.I want it to be like "Videos"

TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
tabLayout.addTab(tabLayout.newTab().setText("Videos"));
tabLayout.addTab(tabLayout.newTab().setText("Notes"));
Shwetabh Singh
  • 197
  • 5
  • 15

2 Answers2

5

Well if I didn't misunderstood you'll have to create a styles.xml as follows :

<style name="CustomTabs" parent="TextAppearance.Design.Tab">
    <item name="android:textSize">YOUR_TEXT_SIZE</item>
    <item name="android:textAllCaps">false</item>
</style>

And then in your layout where you put the TabLayout add this :

app:tabTextAppearance="@style/CustomTabs"

And if you don't want to show the title without capitalleters you'll have to add on yout style this aswell :

<item name="android:textAllCaps">false</item>

SOLUTION

Best way is to add this in your TabLayout xml

app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148
0

Use this style to LayLayout

<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
      <item name="tabTextAppearance">@style/MyCustomTextAppearance</item>
</style>

make tab textAllCaps false

<style name="MyCustomTextAppearance" parent="TextAppearance.Design.Tab">
      <item name="textAllCaps">false</item>
</style>
N J
  • 27,217
  • 13
  • 76
  • 96