java.lang.Object | |
↳ | 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>
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Keyboard.Key | Class for describing the position and characteristics of a single key in the keyboard. | ||||||||||
Keyboard.Row | 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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | EDGE_BOTTOM | ||||||||||
int | EDGE_LEFT | ||||||||||
int | EDGE_RIGHT | ||||||||||
int | EDGE_TOP | ||||||||||
int | KEYCODE_ALT | ||||||||||
int | KEYCODE_CANCEL | ||||||||||
int | KEYCODE_DELETE | ||||||||||
int | KEYCODE_DONE | ||||||||||
int | KEYCODE_MODE_CHANGE | ||||||||||
int | KEYCODE_SHIFT |
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.
| |||||||||||
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the total height of the keyboard
| |||||||||||
Returns the indices of the keys that are closest to the given point.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Default horizontal gap between keys.
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), 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.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol horizontalGap
.
Default height of a key, in pixels or percentage of display width.
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), 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.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol keyHeight
.
Default width of a key, in pixels or percentage of display width.
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), 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.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol keyWidth
.
Default vertical gap between rows of keys.
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), 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.
This may also be a reference to a resource (in the form
"@[package:]type:name
") or
theme attribute (in the form
"?[package:][type:]name
")
containing a value of this type.
This corresponds to the global attribute
resource symbol verticalGap
.
Creates a keyboard from the given xml key layout file.
context | the application or service context |
---|---|
xmlLayoutResId | the resource file that contains the keyboard layout and keys. |
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.
context | the application or service context |
---|---|
xmlLayoutResId | the resource file that contains the keyboard layout and keys. |
modeId | keyboard mode identifier |
width | sets width of keyboard |
height | sets height of keyboard |
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.
context | the application or service context |
---|---|
xmlLayoutResId | the resource file that contains the keyboard layout and keys. |
modeId | keyboard mode identifier |
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.
context | the application or service context |
---|---|
layoutTemplateResId | the layout template file, containing no keys. |
characters | the list of characters to display on the keyboard. One key will be created for each character. |
columns | 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. |
Returns the total height of the keyboard
Returns the indices of the keys that are closest to the given point.
x | the x-coordinate of the point |
---|---|
y | the y-coordinate of the point |