如何将 com.google.android.material.button.MaterialButton 的文本转换为小写

8
如何使 MaterialButton 的文本变为小写? textAllCaps =“false”对我无效。我正在使用 com.google.android.material:material:1.0.0-alpha3
<com.google.android.material.button.MaterialButton
    android:id="@+id/material_button"
    style="@style/Widget.MaterialComponents.Button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_label_enabled"/>

1
你尝试过使用 app:textAllCaps="false" 吗? - Ruan_Lopes
2
谢谢,它只需要使用“app:textAllCaps =“false””,不需要“android:textAllCaps”,Android Studio没有自动完成,所以我认为该属性不存在。 - Jeffrey Liu
1个回答

21

要禁用所有字母大写设置,您需要将textAllCapsandroid:textAllCaps都设置为false。


6
谢谢,它只需要使用"app:textAllCaps = false"就可以了,不需要"android:textAllCaps",Android Studio没有自动完成,所以我认为这个属性不存在。 - Jeffrey Liu
而在Kotlin中,通过编程方式只需使用button.isAllCaps = false就可以实现。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接