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)
2 Answers
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
-
1But the problem is it requires API 14(minimum) .. I need something that run in API 9(minimum)... Apr 23, 2014 at 18:13
-
@user3565490 I made an edit. Also, in the future you should include details like that in your question.– adnealApr 23, 2014 at 19:12
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>
-
But the problem is it requires API 14(minimum) .. I need something that run in API 9(minimum)... – Apr 23, 2014 at 18:14