问题描述
我在我的 android.support.design.widget.TabLayout
中设置了 android:textAllCaps="false"
认为它只显示所有大写的标签标题.
I have set android:textAllCaps="false"
in my android.support.design.widget.TabLayout
thought it is showing the Tab Title in All caps only.
如何去除所有大写字母?
How can I remove all caps?
推荐答案
UPDATE FOR DESIGN LIBRARY 23.2.0+
原始答案不适用于设计库 23.2.0 或更高版本.感谢@fahmad6 在评论中指出,如果有人错过了该评论,我会把它放在这里.您需要将 textAllCaps
和 android:textAllCaps
都设置为 false
以禁用所有大写设置.
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>
原答案
默认情况下,由 TabLayout 创建的选项卡将 textAllCaps 属性设置为 true,您必须定义一个样式,使该标志为 false.
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>
这篇关于android:textAllCaps="false";不适用于 TabLayout 设计支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!