0Pricing
Android Academy · Lesson

Keyboard Options and Actions

Keyboard types, IME actions and focus.

The Right Keyboard for the Job

A polished form shows the correct on-screen keyboard: digits for a phone, an @ key for email, a "Next" button to move between fields. Compose controls all of this with KeyboardOptions and KeyboardActions.

In this lesson you'll set keyboard types, IME actions, and manage focus between fields.

Choosing the Keyboard Type

Pass KeyboardOptions to a text field and set keyboardType. The system then shows a keyboard suited to the data.

Common values: Text, Number, Email, Phone, Password.

var email by remember { mutableStateOf("") }

OutlinedTextField(
    value = email,
    onValueChange = { email = it },
    label = { Text("Email") },
    keyboardOptions = KeyboardOptions(
        keyboardType = KeyboardType.Email
    )
)

All lessons in this course

  1. TextField and User Input
  2. Managing Form State
  3. Validating Input
  4. Keyboard Options and Actions
← Back to Android Academy