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"/>
相关推荐
alexhilton4 小时前
Compose中的CameraX二维码扫描器
android·kotlin·android jetpack
eric*16887 小时前
Android15 enableEdgeToEdge 全面屏沉浸式体验
android·edgetoedge
小智社群9 小时前
小米安卓真机ADB对硬件操作
android·adb
嗷o嗷o9 小时前
Android BLE 为什么连上了却收不到数据
android
pengyu9 小时前
【Kotlin 协程修仙录 · 炼气境 · 后阶】 | 划定疆域:CoroutineScope 与 Android 生命周期的绑定艺术
android·kotlin
朝星9 小时前
Android开发[5]:组件化之路由+注解
android·kotlin
随遇丿而安9 小时前
Android全功能终极创作
android
随遇丿而安9 小时前
第1周:别小看 `TextView`,它其实是 Android 页面里最常被低估的组件
android
summerkissyou198713 小时前
Android-基础-SystemClock.elapsedRealtime和System.currentTimeMillis区别
android
ian4u13 小时前
车载 Android C++ 完整技能路线:从基础到进阶
android·开发语言·c++