Android imagebutton: how to remove a rendered rectangle around an image?

I am developing an android application. I have a main menu with a lot of image buttons, each of which takes the user to a new view when clicked.

The problem I ran into is that the surrounding each icon is a shaded rectangle that changes to blue when clicked. How can I remove this transparent square in the .xml layout file?

Thank you very much in advance,

+3


source to share


3 answers


they probably have a default background from the android system. to remove this define a transparent color

<color name="transparent">#00000000</color>

      

and then use it as background in your buttons



<ImageButton android:src="@drawable/button"
             android:background="@color/transparent"/>

      

I think it will work the way you want

+5


source


I know theres now a rectangle or color when you use your own buttons. Create, implement and use them, then you won't have a rectangle



0


source


You can always use a framework

android:background="@android:color/transparent"

But for what you are trying to archive this is the best solution :

android:background="@null"

0


source







All Articles