首页 > 解决方案 > 从材料组件上的按钮中删除等宽字体

问题描述

如何使用新材料组件从按钮中删除等宽字体?

<com.google.android.material.button.MaterialButton
        android:id="@+id/btn_register"
        style="@style/Widget.MaterialComponents.Button"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        app:fontFamily="@font/lato"
        app:backgroundTint="@color/white"
        android:textColor="?colorPrimary"
        android:text="Open Register Screen" />

这张图片显示了我想要消除的差异:

标签: androidmaterial-componentsmaterial-components-android

解决方案


我发现了问题。它不是等宽字体,它是letterSpacing. 所以我只是添加android:letterSpacing="0"按钮来解决。


推荐阅读