如何改变动作条标签文本样式?样式、文本、动作、标签

2023-09-14 00:01:28 作者:此情谁赋

在默认情况下Android的动作条选项卡的文本样式作为资本。如何设置文本样式正常驼峰风格。像ABCD,而不是ABCD(这是由默认的样式)

By default android actionBar Tab has text-style as CAPITAL. How can I set the text-style to normal camel-case style. Like "Abcd" instead of "ABCD"(Which is the by-default style)

推荐答案

为了使标签文本小写,创造一种风格,继承了 Widget.Holo.Light.ActionBar.TabText Widget.Holo.ActionBar.TabText ,并设置安卓textAllCaps

To make the tab text lowercase, create a style that inherits Widget.Holo.Light.ActionBar.TabText Widget.Holo.ActionBar.TabText and set android:textAllCaps to false.

您可以使用安卓应用自己的 ActionBar.Tab 文本样式。

You can apply your own ActionBar.Tab text style by using the android:actionBarTabTextStyle attribute.

有关 AppCompat 的兼容性,你的风格要继承 Widget.AppCompat.Light.ActionBar.TabText Widget.AppCompat.ActionBar.TabText 和属性都与上述相同,减去机器人 preFIX。

For AppCompat compatibility, your style should inherit Widget.AppCompat.Light.ActionBar.TabText or Widget.AppCompat.ActionBar.TabText and the attributes are the same as above, minus the android prefix.

有关详细信息,请阅读:风格化的动作条

For more information, you should read: Styling the 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>

值-V14

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

结果

 
精彩推荐
图片推荐