按钮可绘制图标未显示

Joj*_*ojo 1 android android-layout material-design

我试图在按钮上的文本之前显示一个普通的图标。我知道它应该如何工作,我也不知道为什么它不起作用。

我已经尝试过的事情:

  • 最基本和孤立的按钮
  • 多种样式或无样式
  • 多个图标
  • 我能找到的所有堆栈溢出答案都不适用于我

这是我使用的代码:

<Button
    style="@style/Widget.MaterialComponents.Button.OutlinedButton"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:drawableStart="@drawable/ic_check_black_24dp"
    android:text="Button with Left Icon" />
Run Code Online (Sandbox Code Playgroud)

关于我可以尝试的方法或如何使带图标的按钮不同的任何提示?

小智 5

这样尝试

<com.google.android.material.button.MaterialButton
    android:id="@+id/btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TEXT"
    style="@style/Widget.AppCompat.Button.Borderless"
    app:icon="@drawable/ic_refresh_black_24dp"

    />
Run Code Online (Sandbox Code Playgroud)