Android Button字母自動全部大寫的問題

兩種解決方案:


方法一:

在 xml 佈局中設置屬性 android:textAllCaps="false"

<Button
	android:layout_width="wrap_content"
	android:layout_height="match_parent"
	android:text="添加動作組"
	android:textAllCaps="false"
	android:id="@+id/btn_action_add"/>

效果: 單個組件生效


方法二:

style 中加入 <item name="android:textAllCaps">false</item>

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textAllCaps">false</item>
</style>

效果:全局生效

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章