Most visited

Recently visited

Added in API level 3

KeyboardView.OnKeyboardActionListener

public static interface KeyboardView.OnKeyboardActionListener

android.inputmethodservice.KeyboardView.OnKeyboardActionListener


虚拟键盘事件的监听器。

Summary

Public methods

abstract void onKey(int primaryCode, int[] keyCodes)

发送按键给听众。

abstract void onPress(int primaryCode)

当用户按下某个键时调用。

abstract void onRelease(int primaryCode)

当用户释放密钥时调用。

abstract void onText(CharSequence text)

向侦听器发送一系列字符。

abstract void swipeDown()

当用户快速将手指从上至下移动时调用。

abstract void swipeLeft()

当用户从右向左快速移动手指时调用。

abstract void swipeRight()

当用户从左向右快速移动手指时调用。

abstract void swipeUp()

当用户快速将手指从下往上移动时调用。

Public methods

onKey

Added in API level 3
void onKey (int primaryCode, 
                int[] keyCodes)

发送按键给听众。

Parameters
primaryCode int: this is the key that was pressed
keyCodes int: the codes for all the possible alternative keys with the primary code being the first. If the primary key code is a single character such as an alphabet or number or symbol, the alternatives will include other characters that may be on the same key or adjacent keys. These codes are useful to correct for accidental presses of a key adjacent to the intended key.

onPress

Added in API level 3
void onPress (int primaryCode)

当用户按下某个键时调用。 这是在调用onKey(int, int[])之前发送的。 对于重复的键,这只会被调用一次。

Parameters
primaryCode int: the unicode of the key being pressed. If the touch is not on a valid key, the value will be zero.

onRelease

Added in API level 3
void onRelease (int primaryCode)

当用户释放密钥时调用。 这是在onKey(int, int[])被调用后发送的。 对于重复的键,这只会被调用一次。

Parameters
primaryCode int: the code of the key that was released

onText

Added in API level 3
void onText (CharSequence text)

向侦听器发送一系列字符。

Parameters
text CharSequence: the sequence of characters to be displayed.

swipeDown

Added in API level 3
void swipeDown ()

当用户快速将手指从上至下移动时调用。

swipeLeft

Added in API level 3
void swipeLeft ()

当用户从右向左快速移动手指时调用。

swipeRight

Added in API level 3
void swipeRight ()

当用户从左向右快速移动手指时调用。

swipeUp

Added in API level 3
void swipeUp ()

当用户快速将手指从下往上移动时调用。

Hooray!