{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

KeyboardOptions


The keyboard configuration options for TextFields. It is not guaranteed if software keyboard will comply with the options provided here.

Summary

Public companion properties

KeyboardOptions

Default KeyboardOptions.

Cmn

Public constructors

KeyboardOptions(
    capitalization: KeyboardCapitalization,
    autoCorrect: Boolean,
    keyboardType: KeyboardType,
    imeAction: ImeAction
)
Cmn

Public functions

KeyboardOptions
copy(
    capitalization: KeyboardCapitalization,
    autoCorrect: Boolean,
    keyboardType: KeyboardType,
    imeAction: ImeAction
)
Cmn
open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open String
Cmn

Public properties

Boolean

informs the keyboard whether to enable auto correct.

Cmn
KeyboardCapitalization

informs the keyboard whether to automatically capitalize characters, words or sentences.

Cmn
ImeAction

The IME action.

Cmn
KeyboardType

The keyboard type to be used in this text field.

Cmn

Public companion properties

Default

val DefaultKeyboardOptions

Default KeyboardOptions. Please see parameter descriptions for default values.

Public constructors

KeyboardOptions

KeyboardOptions(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.None,
    autoCorrect: Boolean = true,
    keyboardType: KeyboardType = KeyboardType.Text,
    imeAction: ImeAction = ImeAction.Default
)
Parameters
capitalization: KeyboardCapitalization = KeyboardCapitalization.None

informs the keyboard whether to automatically capitalize characters, words or sentences. Only applicable to only text based KeyboardTypes such as KeyboardType.Text, KeyboardType.Ascii. It will not be applied to KeyboardTypes such as KeyboardType.Number.

autoCorrect: Boolean = true

informs the keyboard whether to enable auto correct. Only applicable to text based KeyboardTypes such as KeyboardType.Email, KeyboardType.Uri. It will not be applied to KeyboardTypes such as KeyboardType.Number. Most of keyboard implementations ignore this value for KeyboardTypes such as KeyboardType.Text.

keyboardType: KeyboardType = KeyboardType.Text

The keyboard type to be used in this text field. Note that this input type is honored by keyboard and shows corresponding keyboard but this is not guaranteed. For example, some keyboards may send non-ASCII character even if you set KeyboardType.Ascii.

imeAction: ImeAction = ImeAction.Default

The IME action. This IME action is honored by keyboard and may show specific icons on the keyboard. For example, search icon may be shown if ImeAction.Search is specified. When ImeOptions.singleLine is false, the keyboard might show return key rather than the action requested here.

Public functions

copy

fun copy(
    capitalization: KeyboardCapitalization = this.capitalization,
    autoCorrect: Boolean = this.autoCorrect,
    keyboardType: KeyboardType = this.keyboardType,
    imeAction: ImeAction = this.imeAction
): KeyboardOptions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

autoCorrect

val autoCorrectBoolean

informs the keyboard whether to enable auto correct. Only applicable to text based KeyboardTypes such as KeyboardType.Email, KeyboardType.Uri. It will not be applied to KeyboardTypes such as KeyboardType.Number. Most of keyboard implementations ignore this value for KeyboardTypes such as KeyboardType.Text.

capitalization

val capitalizationKeyboardCapitalization

informs the keyboard whether to automatically capitalize characters, words or sentences. Only applicable to only text based KeyboardTypes such as KeyboardType.Text, KeyboardType.Ascii. It will not be applied to KeyboardTypes such as KeyboardType.Number.

imeAction

val imeActionImeAction

The IME action. This IME action is honored by keyboard and may show specific icons on the keyboard. For example, search icon may be shown if ImeAction.Search is specified. When ImeOptions.singleLine is false, the keyboard might show return key rather than the action requested here.

keyboardType

val keyboardTypeKeyboardType

The keyboard type to be used in this text field. Note that this input type is honored by keyboard and shows corresponding keyboard but this is not guaranteed. For example, some keyboards may send non-ASCII character even if you set KeyboardType.Ascii.