Android5.0Button字体大小写

本文介绍了解决Android 5.0及以上版本中Button文本默认显示为大写的问题。通过设置Button的textAllCaps属性为false,可以避免文本被强制转换为大写。此外,还介绍了如何在全局样式中设置此属性,以简化多个Button的配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Android5.0版本以上如果Button设置了字母的话会全部变成大写

这个时候我们需要对其进行设置

 

Button中如果设置了英文字母,在eclipse视图中或者手机上都会显示成大写字母。

设置属性:Android:textAllCaps="false"  就OK了。

如果不想为每个Button都去设置的话,可以在Application中

 

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">


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

 

 

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- 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>

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

优雅的心情

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值