moz*_*afr 1 xml android material-design android-tablayout
我在 com.google.android.material.tabs.TabItem 中设置了 android:textAllCaps="false" ,认为它仅显示全部大写的选项卡标题。
如何删除所有大写字母?
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<com.google.android.material.tabs.TabItem
android:id="@+id/TabWeekly"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/Weekly"
android:textAllCaps="false"
android:theme="@style/CustomTextAppearanceTab" />
<com.google.android.material.tabs.TabItem
android:id="@+id/TabMonthly"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/Monthly"
android:textAllCaps="false"
android:theme="@style/CustomTextAppearanceTab" />
</com.google.android.material.tabs.TabLayout>
Run Code Online (Sandbox Code Playgroud)
即使我已经为它设定了风格
<style name="CustomTextAppearanceTab" parent="TextAppearance.Design.Tab">
<item name="textAllCaps">false</item>
<item name="android:textAllCaps">false</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但它不起作用
定制风格
<style name="customTabLayout" parent="Widget.Design.TabLayout">
<item name="tabTextAppearance">@style/TabTextAppearance</item>
</style>
<style name="TabTextAppearance" parent="@android:style/TextAppearance.Widget.TabWidget">
<item name="android:textAllCaps">false</item>
</style>
Run Code Online (Sandbox Code Playgroud)
选项卡布局 xml 代码
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab"
style="@style/customTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2797 次 |
| 最近记录: |