Show navigation Hide navigation

Input Controls

Input controls are the interactive components in your app's user interface. Android provides a wide variety of controls you can use in your UI, such as buttons, text fields, seek bars, checkboxes, zoom buttons, toggle buttons, and many more.

Adding an input control to your UI is as simple as adding an XML element to your XML layout. For example, here's a layout with a text field and button:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
    <EditText android:id="@+id/edit_message"
        android:hint="@string/edit_message" />
    <Button android:id="@+id/button_send"
        android:onClick="sendMessage" />

Each input control supports a specific set of input events so you can handle events such as when the user enters text or touches a button.

Common Controls

Here's a list of some common controls that you can use in your app. Follow the links to learn more about using each one.

Note: Android provides several more controls than are listed here. Browse the android.widget package to discover more. If your app requires a specific kind of input control, you can build your own custom components.

Control Type Description Related Classes
Button A push-button that can be pressed, or clicked, by the user to perform an action. Button
Text field An editable text field. You can use the AutoCompleteTextView widget to create a text entry widget that provides auto-complete suggestions EditText, AutoCompleteTextView
Checkbox An on/off switch that can be toggled by the user. You should use checkboxes when presenting users with a group of selectable options that are not mutually exclusive. CheckBox
Radio button Similar to checkboxes, except that only one option can be selected in the group. RadioGroup
Toggle button An on/off button with a light indicator. ToggleButton
Spinner A drop-down list that allows users to select one value from a set. Spinner
Pickers A dialog for users to select a single value for a set by using up/down buttons or via a swipe gesture. Use a DatePickercode> widget to enter the values for the date (month, day, year) or a TimePicker widget to enter the values for a time (hour, minute, AM/PM), which will be formatted automatically for the user's locale. DatePicker, TimePicker