Android 默认项目中 Button 大写修改

2020-10-19  本文已影响0人  _一叶孤帆

默认创建的Android项目,当你在 Button 上显示内容时,会默认显示为大写。

如下:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <Button
        android:id="@+id/button1"
        android:text="Button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
image.png

解决方案

找到 styles.xml 文件

image.png

按照下图添加:


image.png
<item name="textAllCaps">false</item>

验证

image.png
上一篇 下一篇

猜你喜欢

热点阅读