0

I have created a button that has an image in it and it looks as follows:

enter image description here

The xml for the button is:

<Button
    android:id="@+id/btn_Whishlist"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginStart="24dp"
    android:layout_marginEnd="24dp"
    android:background="@android:color/transparent"
    android:drawableStart="@drawable/btn_whishlist"
    android:gravity="start|center_vertical"
    android:text="Whishlist"
    android:textAllCaps="false"
    android:textColor="@color/colorGray"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toStartOf="@+id/tv_WhishlistBooksCount"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0" />

Where the drawable is:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:drawable="@drawable/ic_profile_whishlist"
        android:width="24dp"
        android:height="24dp"
        />

</layer-list >

I'm trying to add some space between the image of the heart to the text saying Whishlist however I can't figure out how to do it.

Any ideas?

Thank you

Ben
  • 1,737
  • 2
  • 30
  • 61
  • Check also this [question](https://stackoverflow.com/questions/58410419/on-a-button-text-and-drawable-are-too-far-away-when-centered/58410632#58410632) – Gabriele Mariotti Oct 17 '19 at 21:39

1 Answers1

0

Add drawablePadding to your button