Any way to remove the grey background from ImageButtons?

Just use android:background="#0000" (#0000 same with #00000000) or

ImageButton imageButton = new ImageButton(this);
imageButton.setBackgroundDrawable(null);

I'm having the same problem but now it has been solved. If you are using "android:background="@null" it will resulted of no background at all and no button pressed animation will be appeared to the user.

Just adding this line of code to make an image button become flashing upon clicked. This is the proper way to alert the user an image button has been clicked.

 "android:background="?android:selectableItemBackground" 

You can keep the square box and just change its color like this:

android:backgroundTint="@color/colorPrimary"

works beautifully


The default background is not transparent.

So, just add the transparent color "#00000000" as you background, then you could solve it.

p.s. #00000000 is the transparent color

<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon" 
android:background="#00000000"
/>