Button
Android offers several types of Button elements, including raised buttons and flat buttons as shown in the figure below. Each button has three states: normal, disabled, and pressed.

Raised button
Use the Button element in the layout file. A raised Button is the default style.
Flat button
Flat button borderless
Implementing click listener
Use the
findViewById()method of theViewclass to find theButtonin the XML layout file:Override the
onClick()method:

Last updated
Was this helpful?