Most visited

Recently visited

Added in API level 1

BaseKeyListener

public abstract class BaseKeyListener
extends MetaKeyKeyListener implements KeyListener

java.lang.Object
   ↳ android.text.method.MetaKeyKeyListener
     ↳ android.text.method.BaseKeyListener
Known Direct Subclasses
Known Indirect Subclasses


关键侦听器的抽象基类。 为输入和编辑文本提供了基础。 当键被按下时,子类应覆盖onKeyDown(View, Editable, int, KeyEvent)onKeyUp(View, Editable, int, KeyEvent)以插入字符。

As for all implementations of KeyListener, this class is only concerned with hardware keyboards. Software input methods have no obligation to trigger the methods in this class.

Summary

Inherited constants

From class android.text.method.MetaKeyKeyListener

Public constructors

BaseKeyListener()

Public methods

boolean backspace(View view, Editable content, int keyCode, KeyEvent event)

执行在 KEYCODE_DEL中按 KEYCODE_DEL键时发生的 TextView

boolean forwardDelete(View view, Editable content, int keyCode, KeyEvent event)

执行在 KEYCODE_FORWARD_DEL中按下 KEYCODE_FORWARD_DEL键时发生的 TextView

boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event)

处理元键的按下。

boolean onKeyOther(View view, Editable content, KeyEvent event)

基本实现通过将事件的文本插入内容来处理ACTION_MULTIPLE KEYCODE_UNKNOWN。

Inherited methods

From class android.text.method.MetaKeyKeyListener
From class java.lang.Object
From interface android.text.method.KeyListener

Public constructors

BaseKeyListener

Added in API level 1
BaseKeyListener ()

Public methods

backspace

Added in API level 1
boolean backspace (View view, 
                Editable content, 
                int keyCode, 
                KeyEvent event)

执行在KEYCODE_DEL中按KEYCODE_DEL键时发生的TextView 如果有选择,则删除选择; 否则,删除光标前的字符,如果有的话; ALT + DEL删除光标所在行上的所有内容。

Parameters
view View
content Editable
keyCode int
event KeyEvent
Returns
boolean true if anything was deleted; false otherwise.

forwardDelete

Added in API level 11
boolean forwardDelete (View view, 
                Editable content, 
                int keyCode, 
                KeyEvent event)

执行在KEYCODE_FORWARD_DEL中按下KEYCODE_FORWARD_DEL键时发生的TextView 如果有选择,则删除选择; 否则,删除光标前的字符,如果有的话; ALT + FORWARD_DEL删除光标所在行上的所有内容。

Parameters
view View
content Editable
keyCode int
event KeyEvent
Returns
boolean true if anything was deleted; false otherwise.

onKeyDown

Added in API level 1
boolean onKeyDown (View view, 
                Editable content, 
                int keyCode, 
                KeyEvent event)

处理元键的按下。

Parameters
view View
content Editable
keyCode int
event KeyEvent
Returns
boolean

onKeyOther

Added in API level 3
boolean onKeyOther (View view, 
                Editable content, 
                KeyEvent event)

基本实现通过将事件的文本插入内容来处理ACTION_MULTIPLE KEYCODE_UNKNOWN。

Parameters
view View
content Editable
event KeyEvent
Returns
boolean

Hooray!