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

Popup keyboard close button clicked.

open Unit

This is called when the view is detached from a window.

open Unit
onDraw(canvas: Canvas)

Implement this to do your drawing.

open Boolean

Implement this method to handle hover events.

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

Measure the view and its content to determine the measured width and the measured height.

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

This is called during layout when the size of this view has changed.

open Boolean

Implement this method to handle pointer events.

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

This is called when the view is attached to a window.

open Boolean

Called when a key is long pressed.

open Unit

open Unit

open Unit

open Unit

Inherited functions