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,
    platformImeOptions: PlatformImeOptions?,
    showKeyboardOnFocus: Boolean?,
    hintLocales: LocaleList?
)

This function is deprecated. Please use the new constructor that takes optional autoCorrectEnabled parameter.

Cmn
KeyboardOptions(
    capitalization: KeyboardCapitalization,
    autoCorrectEnabled: Boolean?,
    keyboardType: KeyboardType,
    imeAction: ImeAction,
    platformImeOptions: PlatformImeOptions?,
    showKeyboardOnFocus: Boolean?,
    hintLocales: LocaleList?
)
Cmn

Public functions

KeyboardOptions
copy(
    capitalization: KeyboardCapitalization,
    autoCorrectEnabled: Boolean?,
    keyboardType: KeyboardType,
    imeAction: ImeAction,
    platformImeOptions: PlatformImeOptions?,
    showKeyboardOnFocus: Boolean?,
    hintLocales: LocaleList?
)

Returns a copy of this object with the values passed to this method.

Cmn
open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
KeyboardOptions

Returns a new KeyboardOptions that is a combination of this options and a given other options.

Cmn
open String
Cmn

Public properties

Boolean

This property is deprecated. Please use the autoCorrectEnabled property.

Cmn
Boolean?

informs the keyboard whether to enable auto correct.

Cmn
KeyboardCapitalization

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

Cmn
LocaleList?

List of the languages that the user is supposed to switch to no matter what input method subtype is currently used.

Cmn
ImeAction

The IME action.

Cmn
KeyboardType

The keyboard type to be used in this text field.

Cmn
PlatformImeOptions?

defines the platform specific IME options.

Cmn
Boolean?

when true, software keyboard will show on focus gain.

Cmn

Public companion properties

Default

val DefaultKeyboardOptions

Default KeyboardOptions. Please see parameter descriptions for default values.

Public constructors

KeyboardOptions

KeyboardOptions(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified,
    autoCorrect: Boolean,
    keyboardType: KeyboardType = KeyboardType.Unspecified,
    imeAction: ImeAction = ImeAction.Unspecified,
    platformImeOptions: PlatformImeOptions? = null,
    showKeyboardOnFocus: Boolean? = null,
    hintLocales: LocaleList? = null
)

KeyboardOptions

KeyboardOptions(
    capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified,
    autoCorrectEnabled: Boolean? = null,
    keyboardType: KeyboardType = KeyboardType.Unspecified,
    imeAction: ImeAction = ImeAction.Unspecified,
    platformImeOptions: PlatformImeOptions? = null,
    showKeyboardOnFocus: Boolean? = null,
    hintLocales: LocaleList? = null
)
Parameters
capitalization: KeyboardCapitalization = KeyboardCapitalization.Unspecified

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.

autoCorrectEnabled: Boolean? = null

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. A null value (the default parameter value) means autocorrect will be enabled.

keyboardType: KeyboardType = KeyboardType.Unspecified

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.Unspecified

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.

platformImeOptions: PlatformImeOptions? = null

defines the platform specific IME options.

showKeyboardOnFocus: Boolean? = null

when true, software keyboard will show on focus gain. When false, the user must interact (e.g. tap) before the keyboard is shown. A null value (the default parameter value) means the keyboard will be shown on focus.

hintLocales: LocaleList? = null

List of the languages that the user is supposed to switch to no matter what input method subtype is currently used. This special "hint" can be used mainly for, but not limited to, multilingual users who want IMEs to switch language based on editor's context. Pass null to express the intention that a specific hint should not be set.

Public functions

copy

fun copy(
    capitalization: KeyboardCapitalization = this.capitalization,
    autoCorrectEnabled: Boolean? = this.autoCorrectEnabled,
    keyboardType: KeyboardType = this.keyboardType,
    imeAction: ImeAction = this.imeAction,
    platformImeOptions: PlatformImeOptions? = this.platformImeOptions,
    showKeyboardOnFocus: Boolean? = null,
    hintLocales: LocaleList? = null
): KeyboardOptions

Returns a copy of this object with the values passed to this method.

Note that if an unspecified (null) value is passed explicitly to this method, it will replace any actually-specified value. This differs from the behavior of merge, which will never take an unspecified value over a specified one.

equals

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

hashCode

open fun hashCode(): Int

merge

fun merge(other: KeyboardOptions?): KeyboardOptions

Returns a new KeyboardOptions that is a combination of this options and a given other options.

others null or Unspecified properties are replaced with the non-null properties of this object.

If the either this or other is null, returns the non-null one.

toString

open fun toString(): String

Public properties

autoCorrect

val autoCorrectBoolean

autoCorrectEnabled

val autoCorrectEnabledBoolean?

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. A null value (the default parameter value) means autocorrect will be enabled.

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.

hintLocales

val hintLocalesLocaleList?

List of the languages that the user is supposed to switch to no matter what input method subtype is currently used. This special "hint" can be used mainly for, but not limited to, multilingual users who want IMEs to switch language based on editor's context. Pass null to express the intention that a specific hint should not be set.

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.

platformImeOptions

val platformImeOptionsPlatformImeOptions?

defines the platform specific IME options.

showKeyboardOnFocus

val showKeyboardOnFocusBoolean?

when true, software keyboard will show on focus gain. When false, the user must interact (e.g. tap) before the keyboard is shown. A null value (the default parameter value) means the keyboard will be shown on focus.