如何更改ActionBar Tab textStyle?

Pra*_*ato 2 android

默认情况下,android actionBar Tab的文本样式为CAPITAL.如何将文本样式设置为普通的驼峰式样式.像"Abcd"而不是"ABCD"(这是默认的样式)

adn*_*eal 6

要使选项卡文本为小写,请创建一个继承Widget.Holo.Light.ActionBar.TabText Widget.Holo.ActionBar.TabText并设置android:textAllCaps为的样式false.

您可以ActionBar.Tab使用该android:actionBarTabTextStyle属性应用自己的文本样式.

为了AppCompat兼容性,您的样式应该继承Widget.AppCompat.Light.ActionBar.TabText或者Widget.AppCompat.ActionBar.TabText属性与上面相同,减去android前缀.

有关更多信息,请阅读:设置ActionBar的样式

这是一个AppCompat兼容性的例子:

<style name="Your.Theme" parent="@style/Theme.AppCompat.Light">
    <item name="android:actionBarTabTextStyle">@style/Your.TabText.Style</item>
    <item name="actionBarTabTextStyle">@style/Your.TabText.Style</item>
</style>

<style name="Your.TabText.Style" parent="@style/Widget.AppCompat.Light.ActionBar.TabText">
    <item name="textAllCaps">false</item>
</style>
Run Code Online (Sandbox Code Playgroud)

值-V14

<style name="Your.TabText.Style" parent="@android:style/Widget.Holo.Light.ActionBar.TabText">
    <item name="android:textAllCaps">false</item>
</style>
Run Code Online (Sandbox Code Playgroud)

结果

例