Android MaterialButton 显示不正确

Android MaterialButton not displaying correctly

我正在尝试使用 MaterialButton,但它无法正常工作。 我的 androidx 依赖项

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.1.0-alpha10'

我的test.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.button.MaterialButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/Widget.MaterialComponents.Button.OutlinedButton"
        app:strokeColor="@color/colorPrimary"/>

</LinearLayout>

以及我的按钮的屏幕截图,为什么样式不起作用??

来自Docs

Change your app theme to inherit from a Material Components theme

Theme.MaterialComponents
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.DarkActionBar
Theme.MaterialComponents.DayNight
Theme.MaterialComponents.DayNight.NoActionBar
Theme.MaterialComponents.DayNight.DarkActionBar

If you cannot change your theme to inherit from a Material Components theme, you can inherit from a Material Components Bridge theme.

Theme.MaterialComponents.Bridge
Theme.MaterialComponents.Light.Bridge
Theme.MaterialComponents.NoActionBar.Bridge
Theme.MaterialComponents.Light.NoActionBar.Bridge
Theme.MaterialComponents.Light.DarkActionBar.Bridge  

Bridge themes inherit from AppCompat themes, but also define the new Material Components theme attributes for you.