android:text 总为大写字母的原因

当设置某个 Button 的 text 为英文时,界面上显示的是该英文的大写形式(uppercase)。例如:

XML 复制代码
<Button
    android:id="@+id/btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello"/>

Button 显示的文本为:

HELLO

经查询,一般原因是 textAllCaps 属性被设置为 true。因此,只要将该属性设置为 false 即可。

XML 复制代码
<Button
    android:id="@+id/btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello"
    android:textAllCaps="false"/>
相关推荐
我是好小孩3 小时前
【Android】布局优化:include、merge、ViewStub以及Inflate()源码浅析
android
GISer_Jing3 小时前
2025年Flutter与React Native对比
android·flutter·react native
MasterLi80234 小时前
我的读书清单
android·linux·学习
怪兽20144 小时前
fastjson在kotlin不使用kotlin-reflect库怎么使用?
android·开发语言·kotlin
彭同学学习日志4 小时前
Kotlin Fragment 按钮跳转报错解决:Unresolved reference ‘floatingActionButton‘
android·开发语言·kotlin
Gracker6 小时前
Android Perfetto 系列 9 - CPU 信息解读
android
Gracker6 小时前
Android Perfetto 系列 8:深入理解 Vsync 机制与性能分析
android
Gracker6 小时前
Android Perfetto 系列 07 - MainThread 和 RenderThread 解读
android
Gracker6 小时前
Android Perfetto 系列 5:Android App 基于 Choreographer 的渲染流程
android
Gracker6 小时前
Android Perfetto 系列 6:为什么是 120Hz?高刷新率的优势与挑战
android