Transparent background in ImageButton with ripple effect?

Confuse picture Confuse · May 21, 2015 · Viewed 11.3k times · Source

I want to programmatically remove the grey background in ImageButton. I tried many method of removing it like -

imageButton.setBackgroundDrawable(null);

but on implementing them, I don't get the ripple effect on the ImageButton on touch. (No highlighting on touch).

Is there any way to remove the background but preserve the ripple effect or highlight.

Answer

Mohib Irshad picture Mohib Irshad · May 21, 2015

If android:background="?attr/selectableItemBackground" this works than I believe this answer should solve your problem:

https://stackoverflow.com/a/28087443/2534007