Tablayout Tab Title Text in Lower Case

TabLayout Tab Title text in Lower Case

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" />

Android tab titles lowercase

As no solution worked for me, finally I solved it like this:

In my styles.xml to <style name="Base.Widget.Design.TabLayout" parent="@android:style/Theme.Holo">

i just put

 <item name="android:actionBarTabTextStyle">@style/My.TabText.Style</item>

and then below:

 <style name="My.TabText.Style" parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textAllCaps">false</item>
</style>

This is the only solution that works for me!

So the point was to add android:actionBarTabTextStyle and not tabTextAppearance

how To Set Name Of Tabs in Lowercase LIke I Want In android

The default theme for tab views in Android 4.0 (the Holo theme) has android:textAllCaps set to true.
See:

http://android-developers.blogspot.in/2011/04/customizing-action-bar.html

android:textAllCaps=false not working for TabLayout design Support

UPDATE FOR DESIGN LIBRARY 23.2.0+

The original answer doesn't work with design library 23.2.0 or later. Thanks for @fahmad6 pointed out in comment, in case someone missed that comment, I'll put it here. You need to set both textAllCaps and android:textAllCaps to false to disable all capitalize setting.

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

ORIGINAL ANSWER

By default, tabs are created by TabLayout sets the textAllCaps property to be true, you have to define a style making this flag false.

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

<style name="MyCustomTextAppearance" parent="TextAppearance.Design.Tab">
<item name="textAllCaps">false</item>
</style>

tab host title text appears in upper case want in lowercase

thank you ,i have done what suggest in answer as shown above but still not worked so i have made changes in library by go through it code and analyse it. and i found that there is mentioned .toUpperCase() and i remove from there and it works.

Sliding tab layout text is uppercase

Found the answer it was in the createDefaultTabView() method.

Needed to change textView.setAllCaps(true) to false.

protected TextView createDefaultTabView(Context context) {
TextView textView = new TextView(context);
textView.setGravity(Gravity.CENTER);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
textView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
outValue, true);
textView.setBackgroundResource(outValue.resourceId);
textView.setAllCaps(false); **// Changed to false and it did the trick**

int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
textView.setPadding(padding, padding, padding, padding);

return textView;
}

How to set text on tab bar in small letters?

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"


Related Topics



Leave a reply



Submit