How to change ActionBar Tab textStyle?

前端 未结 2 1597
Happy的楠姐
Happy的楠姐 2020-12-12 00:40

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-defaul

相关标签:
2条回答
  • 2020-12-12 01:17

    Apply custom theme to your app where you can change actionbar's properties.

    <style name="Theme.MyAppTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
    </style>
    <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
        <item name="android:textAllCaps">false</item>
    </style>
    
    0 讨论(0)
  • 2020-12-12 01:19

    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.

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

    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

    Here's an example with AppCompat compatibility:

    values

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

    values-v14

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

    Results

    Example

    0 讨论(0)
提交回复
热议问题