The introduction of Android User Interface (UI) Button

Android Button (Source Google Images)

Button is a widget that can be pressed or clicked, by the user to perform an action.

Here are some of the attributes of the Button in the layout file.

android: background : This is the drawable to use as a background.

android: contentDescription: This defines the text that briefly describes the content of the display.

android: id: It gives identity name for this view.

android: onClick: This is the name of the method in the context of this view to be called when the view is clicked.

android: visibility: This controls the initial visibility of the display.

Button or icon consists of text (or text and icons) that communicates what actions occur when users touch it.

Depending on whether you want a button with the text, icons, or both, you can create a button on your layout in three ways:

1. With text, classs Using button
2. With Icon, use ImageButton Class
3. With Text and Icon

as the image below.

3 ways on the button

Source: Master Android (App)

Post Author: Study