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

KeyboardOptions

public final class KeyboardOptions


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

Summary

Nested types

public static class KeyboardOptions.Companion

Public constructors

KeyboardOptions(
    @NonNull KeyboardCapitalization capitalization,
    boolean autoCorrect,
    @NonNull KeyboardType keyboardType,
    @NonNull ImeAction imeAction
)

Public methods

final @NonNull KeyboardOptions
copy(
    @NonNull KeyboardCapitalization capitalization,
    boolean autoCorrect,
    @NonNull KeyboardType keyboardType,
    @NonNull ImeAction imeAction
)
boolean
equals(Object other)
final boolean

informs the keyboard whether to enable auto correct.

final @NonNull KeyboardCapitalization

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

final @NonNull ImeAction

The IME action.

final @NonNull KeyboardType

The keyboard type to be used in this text field.

int
@NonNull String

Public constructors

KeyboardOptions

public KeyboardOptions(
    @NonNull KeyboardCapitalization capitalization,
    boolean autoCorrect,
    @NonNull KeyboardType keyboardType,
    @NonNull ImeAction imeAction
)
Parameters
@NonNull KeyboardCapitalization capitalization

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.

boolean autoCorrect

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.

@NonNull KeyboardType keyboardType

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.

@NonNull ImeAction imeAction

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 methods

copy

public final @NonNull KeyboardOptions copy(
    @NonNull KeyboardCapitalization capitalization,
    boolean autoCorrect,
    @NonNull KeyboardType keyboardType,
    @NonNull ImeAction imeAction
)

equals

public boolean equals(Object other)

getAutoCorrect

public final boolean getAutoCorrect()

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.

getCapitalization

public final @NonNull KeyboardCapitalization getCapitalization()

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.

getImeAction

public final @NonNull ImeAction getImeAction()

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.

getKeyboardType

public final @NonNull KeyboardType getKeyboardType()

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.

hashCode

public int hashCode()

toString

public @NonNull String toString()