A button can be given by selecting ‘Buttons’ option from the ‘Palette’ of the ‘Design’ menu. Following section has the code for a simple button in the android studio.
The following section shows code for a button which changes color on pressing. The background in the button has been given by Drawable Resource File created by right clicking on drawable folder. These files are in .xml file format.
The following section shows the code for a button which has also a shadow. The background in the button is given by ‘Drawable Resource File‘. ‘Drawable Resource File’ is created by right clicking on the drawable folder and then selecting the Drawable Resource File from new. The file is in .xml file format.