Keyboard
open classKeyboard
kotlin.Any | |
↳ | android.inputmethodservice.Keyboard |
Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard consists of rows of keys.
The layout file for a keyboard contains XML that looks like the following snippet:
<Keyboard android:keyWidth="%10p" android:keyHeight="50px" android:horizontalGap="2px" android:verticalGap="2px" > <Row android:keyWidth="32px" > <Key android:keyLabel="A" /> ... </Row> ... </Keyboard>
Summary
Nested classes | |
---|---|
open |
Class for describing the position and characteristics of a single key in the keyboard. |
open |
Container for keys in the keyboard. |
XML attributes | |
---|---|
android:horizontalGap |
Default horizontal gap between keys. |
android:keyHeight |
Default height of a key, in pixels or percentage of display width. |
android:keyWidth |
Default width of a key, in pixels or percentage of display width. |
android:verticalGap |
Default vertical gap between rows of keys. |
Constants | |
---|---|
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int |
Public constructors | |
---|---|
Creates a keyboard from the given xml key layout file. |
|
Creates a keyboard from the given xml key layout file. |
|
Creates a keyboard from the given xml key layout file. |
|
Keyboard(context: Context!, layoutTemplateResId: Int, characters: CharSequence!, columns: Int, horizontalPadding: Int) Creates a blank keyboard from the given resource file and populates it with the specified characters in left-to-right, top-to-bottom fashion, using the specified number of columns. |
Public methods | |
---|---|
open Int |
Returns the total height of the keyboard |
open MutableList<Keyboard.Key!>! |
getKeys() |
open Int | |
open MutableList<Keyboard.Key!>! | |
open IntArray! |
getNearestKeys(x: Int, y: Int) Returns the indices of the keys that are closest to the given point. |
open Int | |
open Boolean | |
open Boolean |
setShifted(shiftState: Boolean) |
Protected methods | |
---|---|
open Keyboard.Key! |
createKeyFromXml(res: Resources!, parent: Keyboard.Row!, x: Int, y: Int, parser: XmlResourceParser!) |
open Keyboard.Row! |
createRowFromXml(res: Resources!, parser: XmlResourceParser!) |
open Int | |
open Int | |
open Int | |
open Int | |
open Unit |
setHorizontalGap(gap: Int) |
open Unit |
setKeyHeight(height: Int) |
open Unit |
setKeyWidth(width: Int) |
open Unit |
setVerticalGap(gap: Int) |
XML attributes
android:horizontalGap
android:horizontalGap
Default horizontal gap between keys. {@deprecated Copy this definition into your own application project.}
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
May be a fractional value, which is a floating point number appended with either % or %p, such as "14.5%
". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.
android:keyHeight
android:keyHeight
Default height of a key, in pixels or percentage of display width. {@deprecated Copy this definition into your own application project.}
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
May be a fractional value, which is a floating point number appended with either % or %p, such as "14.5%
". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.
android:keyWidth
android:keyWidth
Default width of a key, in pixels or percentage of display width. {@deprecated Copy this definition into your own application project.}
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
May be a fractional value, which is a floating point number appended with either % or %p, such as "14.5%
". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.
android:verticalGap
android:verticalGap
Default vertical gap between rows of keys. {@deprecated Copy this definition into your own application project.}
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp
". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).
May be a fractional value, which is a floating point number appended with either % or %p, such as "14.5%
". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.
Constants
EDGE_BOTTOM
static valEDGE_BOTTOM: Int
Deprecated: Deprecated in Java.
Value: 8
KEYCODE_ALT
static valKEYCODE_ALT: Int
Deprecated: Deprecated in Java.
Value: -6
KEYCODE_CANCEL
static valKEYCODE_CANCEL: Int
Deprecated: Deprecated in Java.
Value: -3
KEYCODE_DELETE
static valKEYCODE_DELETE: Int
Deprecated: Deprecated in Java.
Value: -5
KEYCODE_DONE
static valKEYCODE_DONE: Int
Deprecated: Deprecated in Java.
Value: -4
KEYCODE_MODE_CHANGE
static valKEYCODE_MODE_CHANGE: Int
Deprecated: Deprecated in Java.
Value: -2
KEYCODE_SHIFT
static valKEYCODE_SHIFT: Int
Deprecated: Deprecated in Java.
Value: -1
Public constructors
Keyboard
Keyboard(
context: Context!,
xmlLayoutResId: Int)
Creates a keyboard from the given xml key layout file.
Parameters | |
---|---|
context |
Context!: the application or service context |
xmlLayoutResId |
Int: the resource file that contains the keyboard layout and keys. |
Keyboard
Keyboard(
context: Context!,
xmlLayoutResId: Int,
modeId: Int,
width: Int,
height: Int)
Creates a keyboard from the given xml key layout file. Weeds out rows that have a keyboard mode defined but don't match the specified mode.
Parameters | |
---|---|
context |
Context!: the application or service context |
xmlLayoutResId |
Int: the resource file that contains the keyboard layout and keys. |
modeId |
Int: keyboard mode identifier |
width |
Int: sets width of keyboard |
height |
Int: sets height of keyboard |
Keyboard
Keyboard(
context: Context!,
xmlLayoutResId: Int,
modeId: Int)
Creates a keyboard from the given xml key layout file. Weeds out rows that have a keyboard mode defined but don't match the specified mode.
Parameters | |
---|---|
context |
Context!: the application or service context |
xmlLayoutResId |
Int: the resource file that contains the keyboard layout and keys. |
modeId |
Int: keyboard mode identifier |
Keyboard
Keyboard(
context: Context!,
layoutTemplateResId: Int,
characters: CharSequence!,
columns: Int,
horizontalPadding: Int)
Creates a blank keyboard from the given resource file and populates it with the specified characters in left-to-right, top-to-bottom fashion, using the specified number of columns.
If the specified number of columns is -1, then the keyboard will fit as many keys as possible in each row.
Parameters | |
---|---|
context |
Context!: the application or service context |
layoutTemplateResId |
Int: the layout template file, containing no keys. |
characters |
CharSequence!: the list of characters to display on the keyboard. One key will be created for each character. |
columns |
Int: the number of columns of keys to display. If this number is greater than the number of keys that can fit in a row, it will be ignored. If this number is -1, the keyboard will fit as many keys as possible in each row. |
Public methods
getHeight
open fungetHeight(): Int
Deprecated: Deprecated in Java.
Returns the total height of the keyboard
Return | |
---|---|
Int |
the total height of the keyboard |
getKeys
open fungetKeys(): MutableList<Keyboard.Key!>!
Deprecated: Deprecated in Java.
getModifierKeys
open fungetModifierKeys(): MutableList<Keyboard.Key!>!
Deprecated: Deprecated in Java.
getNearestKeys
open fungetNearestKeys(
x: Int,
y: Int
): IntArray!
Deprecated: Deprecated in Java.
Returns the indices of the keys that are closest to the given point.
Parameters | |
---|---|
x |
Int: the x-coordinate of the point |
y |
Int: the y-coordinate of the point |
Return | |
---|---|
IntArray! |
the array of integer indices for the nearest keys to the given point. If the given point is out of range, then an array of size zero is returned. |
getShiftKeyIndex
open fungetShiftKeyIndex(): Int
Deprecated: Deprecated in Java.
setShifted
open funsetShifted(shiftState: Boolean): Boolean
Deprecated: Deprecated in Java.
Protected methods
createKeyFromXml
protected open funcreateKeyFromXml(
res: Resources!,
parent: Keyboard.Row!,
x: Int,
y: Int,
parser: XmlResourceParser!
): Keyboard.Key!
Deprecated: Deprecated in Java.
createRowFromXml
protected open funcreateRowFromXml(
res: Resources!,
parser: XmlResourceParser!
): Keyboard.Row!
Deprecated: Deprecated in Java.
getHorizontalGap
protected open fungetHorizontalGap(): Int
Deprecated: Deprecated in Java.
getKeyHeight
protected open fungetKeyHeight(): Int
Deprecated: Deprecated in Java.
getKeyWidth
protected open fungetKeyWidth(): Int
Deprecated: Deprecated in Java.
getVerticalGap
protected open fungetVerticalGap(): Int
Deprecated: Deprecated in Java.
setHorizontalGap
protected open funsetHorizontalGap(gap: Int): Unit
Deprecated: Deprecated in Java.
setKeyHeight
protected open funsetKeyHeight(height: Int): Unit
Deprecated: Deprecated in Java.
setKeyWidth
protected open funsetKeyWidth(width: Int): Unit
Deprecated: Deprecated in Java.
setVerticalGap
protected open funsetVerticalGap(gap: Int): Unit
Deprecated: Deprecated in Java.