Most visited

Recently visited

Added in API level 1

NumberKeyListener

public abstract class NumberKeyListener
extends BaseKeyListener implements InputFilter

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


用于数字文本输入

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

NumberKeyListener()

Public methods

CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend)

这种方法被称为缓冲区时,将取代范围 dstart … denddest从范围内的新文字 start … endsource

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

处理元键的按下。

Protected methods

abstract char[] getAcceptedChars()

你可以说你可以接受哪些角色。

int lookup(KeyEvent event, Spannable content)
static boolean ok(char[] accept, char c)

Inherited methods

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

Public constructors

NumberKeyListener

Added in API level 1
NumberKeyListener ()

Public methods

filter

Added in API level 1
CharSequence filter (CharSequence source, 
                int start, 
                int end, 
                Spanned dest, 
                int dstart, 
                int dend)

这种方法被称为缓冲区时,将取代范围dstart … denddest从范围内的新文字start … endsource 返回你想要放置在那里的CharSequence,如果合适的话包括一个空字符串,或者null接受原始替换。 注意不要拒绝0长度替换,因为这是删除文本时会发生的情况。 另外请注意,您不应该尝试使用此方法对dest进行任何更改; 你只能在上下文中检查它。 注意:如果sourceSpannedSpannable的实例, Spanned源中的跨度对象复制到过滤结果中(即非空返回值)。 copySpansFrom(Spanned, int, int, Class, Spannable, int)可以用于方便。

Parameters
source CharSequence
start int
end int
dest Spanned
dstart int
dend int
Returns
CharSequence

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

Protected methods

getAcceptedChars

Added in API level 1
char[] getAcceptedChars ()

你可以说你可以接受哪些角色。

Returns
char[]

lookup

Added in API level 1
int lookup (KeyEvent event, 
                Spannable content)

Parameters
event KeyEvent
content Spannable
Returns
int

ok

Added in API level 1
boolean ok (char[] accept, 
                char c)

Parameters
accept char
c char
Returns
boolean

Hooray!