1

How can I achive the same click effect that the Button element has by default but using an ImageButton?

I used to use Buttons with png icons but now I'm changing them to svg icons. To do that I have found out that I have to use ImageButton insted of Button.

I have seen that this can be done by creating a drawable xml file containing a list of states for the button, but I don't need a complicated animation (just the default for the Button). Is there an easy way to achive what I'm looking for?

This is my code:

<ImageButton
    android:id="@+id/editButton"
    android:layout_width="25dp"
    android:layout_height="25dp"
    android:background="#00FFFFFF"
    android:tint="#00FFFFFF"
    app:iconTint="#000000"
    app:srcCompat="@drawable/edit_icon_svg"
    tools:ignore="VectorDrawableCompat" />

Thank you!

a_local_nobody
  • 6,231
  • 5
  • 18
  • 42

0 Answers0