Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TabLayout Tab Title text in Lower Case

I have used android.support.design.widget.TabLayout in my application with Min SDK 15.

By default it takes Tab title in capitals but I want it to make in "textCapsWord". I tried adding Style as suggested here and here. But unfortunate both doesn't work.

like image 954
Krishnakant Avatar asked Oct 08 '15 12:10

Krishnakant


People also ask

How do you change the typeface of a selected tab of a TabLayout?

You can change the font family for selected/unselected tab only programmatically. You can listen which Tab is selected and unselected with TabLayout. OnTabSelectedListener and on onTabSelected(TabLayout. Tab tab) callback you can change the Typeface for the selected Tab and on onTabUnselected(TabLayout.

How do I use TabLayout with Viewpager?

Tab layout are visible below toolbar with View pager, used to create swipeable views . Tabs are designed to work with fragments. Use them to swipe fragments in view pager.


1 Answers

If you add the following line to your TabLayout it should work:

app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget" 

Use it like this:

<android.support.design.widget.TabLayout                     android:id="@+id/tabLayout"                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     app:tabIndicatorColor="@android:color/white"                     app:tabIndicatorHeight="2dp"                     app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"                     app:tabSelectedTextColor="@android:color/white"                     app:tabTextColor="@android:color/white" /> 
like image 155
Mustanser Iqbal Avatar answered Sep 22 '22 21:09

Mustanser Iqbal