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(http://mjanaki.com) - 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

MySql to mongo
Sample nginx vhsot config file
Uninstall MySql on a Mac OS X

Leave a reply

required*

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