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>

效果:全局生效

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