tablayout的title明明是小写的,但是显示出来就是大写的.
查看 TabLayout 属性:tabTextAppearance 的默认样式:
mTabTextAppearance = a.getResourceId(R.styleable.TabLayout_tabTextAppearance,
R.style.TextAppearance_Design_Tab);
TextAppearance_Design_Tab
的默认值为:
</style>
<style name="TextAppearance.Design.Tab" parent="TextAppearance.AppCompat.Button">
<item name="android:textSize">@dimen/design_tab_text_size</item>
<item name="android:textColor">@color/mtrl_tabs_legacy_text_color_selector</item>
<item name="textAllCaps">true</item>
</style>
textAllCaps
属性导致小写 变大写
所以我需要自己定义一个style,如下:
<style name="TabLayoutTextStyle" parent="TextAppearance.Design.Tab">
<item name="textAllCaps">false</item>
<item name="android:textAllCaps">false</item>
</style>
然后将属性添加到布局中:app:tabTextAppearance="@style/TabLayoutTextStyle"