How to change background Image in android ImageButton

Here is the steps to change the background image.

  1.  Create 3 images “mybutton_normal.png, mybutton_focused.png and mybutton_pressed.png”  and put those to “resource/drawable”  folder
  2. Create a new xml file “mybutton.xml” in res/drawable folder. Then add the below xml codes to this file
  3. Now edit your res/layout/layout.xml to add a new normal button. i.e.
  4. Now run your application, you can see the images by clicking the button.

About the author

Janaki( - A Software developer with 9+ years of experience in multiple technology projects across web, mobile, and cloud applications with expertise in PHP, C#, MySQL, Web services and open source platforms.

Similar Posts

Open SSL Commands
Install Jenkins in Amazon Linux2

Leave a reply


Eye Test: * Time limit is exhausted. Please reload CAPTCHA.