UI Widgets

Some common Android UI widgets:

TextView:

Displays text to the user.

Example: <TextView android:id="@+id/textView" android:text="Hello, World!" />

EditText:

Allows the user to input text.

Example: <EditText android:id="@+id/editText" />

Button:

Triggers an action when clicked.

Example: <Button android:id="@+id/button" android:text="Click Me" />

ImageView:

Displays images.

Example: <ImageView android:id="@+id/imageView" android:src="@drawable/icon" />

CheckBox:

Represents a binary choice (checked or unchecked).

Example: <CheckBox android:id="@+id/checkBox" android:text="Agree" />

RadioButton:

Represents a choice among multiple options.

Example: <RadioButton android:id="@+id/radioButton" android:text="Option 1" />

ToggleButton:

A two-state button.

Example: <ToggleButton android:id="@+id/toggleButton" android:text="Toggle" />

Switch:

Represents a two-state switch (on/off).

Example: <Switch android:id="@+id/switch" />

Spinner:

A drop-down list of items.

Example: <Spinner android:id="@+id/spinner" />

ProgressBar:

Shows the progress of an operation.

Example: <ProgressBar android:id="@+id/progressBar" style="?android:attr/progressBarStyleHorizontal" />

SeekBar:

Allows the user to select a value from a range.

Example: <SeekBar android:id="@+id/seekBar" />

ListView:

Displays a scrollable list of items.

Example: <ListView android:id="@+id/listView" />

RecyclerView:

An advanced and more flexible version of ListView for displaying large sets of data.

Example: <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" />

DatePicker:

Allows the user to select a date.

Example: <DatePicker android:id="@+id/datePicker" />

TimePicker:

Allows the user to select a time.

Example: <TimePicker android:id="@+id/timePicker" />

WebView:

Displays web content within an app.

Example: <WebView android:id="@+id/webView" />

RatingBar:

Allows the user to provide a rating.

Example: <RatingBar android:id="@+id/ratingBar" />

GridLayout:

Organizes widgets in a grid.

Example: <GridLayout android:id="@+id/gridLayout" />

CardView:

Provides a material design card-like container.

Example: <androidx.cardview.widget.CardView android:id="@+id/cardView" />

ScrollView:

Allows the user to scroll through content.

Example: <ScrollView android:id="@+id/scrollView" />