Reputation: 1150
I am trying to display a normal icon on before the text on the button. I know how it should work and I don't know why it doesn't.
Things I have already tried:
Here is the code I use:
<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" />
Any tips on what I could try or how I could make a button with icon differently?
Upvotes: 5
Views: 8559
Reputation: 326
Try like this
<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"
/>
Upvotes: 21