Android 样式:将边框设置为 0sp 不会删除 Material 按钮的边框半径

Android Styling: Setting border to 0sp does not remove border radius of Material Button

我正在尝试设置按钮的样式,使其没有边框半径。我已经尝试将 radius 属性 设置为 0sp,但是没有用。下面是我的代码和结果按钮的截图,它仍然有圆角。

<com.google.android.material.button.MaterialButton
        android:id="@+id/material_text_button"
        style="@style/Widget.MaterialComponents.Button.OutlinedButton"
        android:textAppearance="@style/Widget.MaterialComponents.Button.OutlinedButton"
        android:layout_marginTop="11sp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:radius="0sp"
        android:text="#1 Lorem Ipsum"
        android:textSize="16sp"/>

对于圆角半径,使用 app:cornerRadius 属性:

<com.google.android.material.button.MaterialButton
    app:cornerRadius="0dp"
    ../>

Outlined/Filled 结果:

关于您的布局,请在这些尺寸中使用 dp 而不是 sp

    android:layout_marginTop="11sp" //dp
    android:radius="0sp"  //dp and app:cornerRadius

并且这种风格 @style/Widget.MaterialComponents.Button.OutlinedButton 不应在 android:textAppearance 中使用。