tmcb
tmcb

Reputation: 123

Button wrapping content wrongly with drawable inside

While using an android button, I keep coming back to the same problem... When I try to add a drawable to a button, the button keeps wrongly framing the drawable.

The button code:

<Button
        android:id="@+id/cancel_directions_button_v2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:drawableBottom="@drawable/i_close"
        app:layout_constraintStart_toEndOf="@id/info_directions_textview"
        app:layout_constraintBottom_toBottomOf="parent"
        android:backgroundTint="@color/colorPrimary"
        android:layout_marginBottom="26sp"
        android:visibility="gone"
        />

Photo: enter image description here

Upvotes: 0

Views: 42

Answers (1)

M D
M D

Reputation: 91

Try using ImageButton instead.

<ImageButton
    .
    .
    .
    android:src="@android:drawable/i_close" />

Upvotes: 1

Related Questions