Android image button style

Hi, I am confused with the parameters of the image button in android. I created three image buttons with the following xml

<ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:src="@drawable/folder_add" /> <ImageButton android:id="@+id/imageButton4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/imageButton1" android:layout_toLeftOf="@+id/imageButton1" android:src="@drawable/search" /> <ImageButton android:id="@+id/imageButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/imageButton4" android:layout_toLeftOf="@+id/imageButton4" android:src="@drawable/advancedsettings" style="?android:attr/borderlessButtonStyle" /> 

But the output is like a button with an image on it. Please help me show the image only as a button..Thnx in advance!

+4
source share
2 answers

Put this tag in your ImageButton

 android:background="@null" 

It will do it.

+9
source

You can also use transparent color: this will solve your problem.

 android:background="@android:color/transparent" 
+5
source

Source: https://habr.com/ru/post/1436344/


All Articles