Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

background color in a ImageButton

I put a background color in a ImageButton? How?

like image 534
Pedro Avatar asked Jun 25 '10 12:06

Pedro


People also ask

How to set background Color of image button in android?

You can use android:background=" " to set the color of ImageButton and some android widgets. ('#rrggbb' or '@android. color/blue', '@android:color/transparent'). you can follow this example as your reference.

How to set button background in XML?

Go to the layout folder and in the activity_main. xml file change the ConstraintLayout to LinearLayout and give its orientation vertical. Add the Button and Switch to the layout.

What is ImageButton explain with example?

In Android, ImageButton is used to display a normal button with a custom image in a button. In simple words we can say, ImageButton is a button with an image that can be pressed or clicked by the users.

How will you Add graphic to button?

Copy your image file within the Res/drawable/ directory of your project. While in XML simply go into the graphic representation (for simplicity) of your XML file and click on your ImageButton widget that you added, go to its properties sheet and click on the [...] in the src: field. Simply navigate to your image file.


1 Answers

android:background="#rrggbb" 

in XML file with layout definition, then use PNG file with transparency as image source

like image 177
tomash Avatar answered Sep 29 '22 09:09

tomash