Sunday, July 5, 2015

// //

Style a button in android

This time i'll be showing a simple tutorial on how to style the button in xml layout and how to change the color when clicked..


style a button in android




 activitymain.xml

    


now make a new folder in resource directory and named it a drawable. put this blue_button.xml in drawable folder:

 blue_button.xml

  
    
      
      
      
      
    
  
  
    
      
      
      
      
    
  



And copy this code inside your styles.xml in values folder: Insert this code after the tag in styles.xml



Notice the change of color when you tap the button! We don't need any activity.java here! GoodLuck!

 You may also like:Change color of Button in Android when Clicked