2

How can I remove the white spaces around these ImageButtons?

ImageButtons

This is sample code for one one of the ImageButton:

<ImageButton
        android:id="@+id/imageButton3"
        android:layout_width="64dp"
        android:layout_height="56dp"
        android:src="@drawable/ic_circulo"
        app:layout_constraintBottom_toTopOf="@+id/imageButton2"
        app:layout_constraintStart_toStartOf="parent" />

Thanks in advance.

11_22_33
  • 116
  • 1
  • 15
  • Please take a look here https://stackoverflow.com/questions/14105631/removing-image-button-padding-android – Goltsev Eugene Mar 23 '21 at 07:42
  • Hi @GoltsevEugene, thanks for answering. I have read the link but I do not know how to "modify the 9 patches" of the default button. – 11_22_33 Mar 23 '21 at 17:41

1 Answers1

1

Try this :

android:background="@null" or 
android:background="#00000000"
Android Killer
  • 18,174
  • 13
  • 67
  • 90
  • Hi, thanks for answering. However, that removes the gray background and I want to keep it. I can use `android:background="#00000000"` and use my gray color, but then it fills all the space. What I need is simply to remove the space around the gray square, keeping the meisures of the square and the gray color. – 11_22_33 Mar 23 '21 at 17:28
  • Try android:scaleType="fitXY" attribute in your ImageButton along with my answer. And that arrow like thing should be there ? – Android Killer Mar 23 '21 at 18:51