Added in API level 3
Deprecated in API level 29

KeyboardView


open class KeyboardView : View, View.OnClickListener
kotlin.Any
   ↳ android.view.View
   ↳ android.inputmethodservice.KeyboardView

A view that renders a virtual Keyboard. It handles rendering of keys and detecting key presses and touch movements.

Summary

Nested classes
abstract

Listener for virtual keyboard events.

XML attributes
android:keyBackground Image for the key.
android:keyPreviewHeight Height of the key press feedback popup.
android:keyPreviewLayout Layout resource for key press feedback.
android:keyPreviewOffset Vertical offset of the key press feedback from the key.
android:keyTextColor Color to use for the label in a key.
android:keyTextSize Size of the text for character keys.
android:labelTextSize Size of the text for custom keys with some text and no icon.
android:popupLayout Layout resource for popup keyboards.
android:verticalCorrection Amount to offset the touch Y coordinate by, for bias correction.
Inherited XML attributes
Inherited constants
Public constructors
KeyboardView(context: Context!, attrs: AttributeSet!)

KeyboardView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

KeyboardView(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit

open Keyboard!

Returns the current keyboard being displayed by this view.

open Boolean

open Unit

Requests a redraw of the entire keyboard.

open Unit
invalidateKey(keyIndex: Int)

Invalidates a key so that it will be redrawn on the next repaint.

open Boolean

Returns the enabled state of the key feedback popup.

open Boolean

Returns true if proximity correction is enabled.

open Boolean

Returns the state of the shift key of the keyboard, if any.

open Unit

open Unit
onDraw(canvas: Canvas)

open Boolean

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

open Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)

open Boolean

open Unit
setKeyboard(keyboard: Keyboard!)

Attaches a keyboard to this view.

open Unit

open Unit

open Unit

open Unit
setPreviewEnabled(previewEnabled: Boolean)

Enables or disables the key feedback popup.

open Unit

When enabled, calls to OnKeyboardActionListener.onKey will include key codes for adjacent keys.

open Boolean
setShifted(shifted: Boolean)

Sets the state of the shift key of the keyboard, if any.

open Unit
setVerticalCorrection(verticalOffset: Int)

Protected methods
open KeyboardView.OnKeyboardActionListener!

Returns the OnKeyboardActionListener object.

open Unit

open Boolean

Called when a key is long pressed.

open Unit

open Unit

open Unit

open Unit

Inherited functions