Most visited

Recently visited

Added in API level 1

TextKeyListener

public class TextKeyListener
extends BaseKeyListener implements SpanWatcher

java.lang.Object
   ↳ android.text.method.MetaKeyKeyListener
     ↳ android.text.method.BaseKeyListener
       ↳ android.text.method.TextKeyListener


这是输入普通文本的关键监听者。 它委托给适合当前键盘和语言的其他关键侦听器。

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

Nested classes

枚举 TextKeyListener.Capitalize

 

Inherited constants

From class android.text.method.MetaKeyKeyListener

Public constructors

TextKeyListener(TextKeyListener.Capitalize cap, boolean autotext)

用指定的大小写和更正属性创建一个新的TextKeyListener。

Public methods

static void clear(Editable e)

从指定的Editable清除所有输入状态(自动文本,autocap,multitap,撤消),超出Editable.clear(),它只是清除文本而不清除输入状态。

int getInputType()
static TextKeyListener getInstance(boolean autotext, TextKeyListener.Capitalize cap)

返回具有指定大小写和更正属性的新实例或现有实例。

static TextKeyListener getInstance()

返回没有自动大写或更正的新实例或现有实例。

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

处理元键的按下。

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

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

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

处理元键的释放。

void onSpanAdded(Spannable s, Object what, int start, int end)

调用此方法通知您指定的对象已附加到文本的指定范围。

void onSpanChanged(Spannable s, Object what, int start, int end, int st, int en)

调用此方法通知您,指定的对象已从范围 ostart…oend重新定位到文本的新范围 nstart…nend

void onSpanRemoved(Spannable s, Object what, int start, int end)

调用此方法通知您指定的对象已从指定的文本范围中分离。

void release()
static boolean shouldCap(TextKeyListener.Capitalize cap, CharSequence cs, int off)

返回是否有意义在指定的文本中使用指定的规则自动大写指定的位置。

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.SpanWatcher

Public constructors

TextKeyListener

Added in API level 1
TextKeyListener (TextKeyListener.Capitalize cap, 
                boolean autotext)

用指定的大小写和更正属性创建一个新的TextKeyListener。

Parameters
cap TextKeyListener.Capitalize: when, if ever, to automatically capitalize.
autotext boolean: whether to automatically do spelling corrections.

Public methods

clear

Added in API level 1
void clear (Editable e)

从指定的Editable清除所有输入状态(自动文本,autocap,multitap,撤消),超出Editable.clear(),它只是清除文本而不清除输入状态。

Parameters
e Editable: the buffer whose text and state are to be cleared.

getInputType

Added in API level 3
int getInputType ()

Returns
int

getInstance

Added in API level 1
TextKeyListener getInstance (boolean autotext, 
                TextKeyListener.Capitalize cap)

返回具有指定大小写和更正属性的新实例或现有实例。

Parameters
autotext boolean: whether to automatically do spelling corrections.
cap TextKeyListener.Capitalize: when, if ever, to automatically capitalize.
Returns
TextKeyListener

getInstance

Added in API level 1
TextKeyListener getInstance ()

返回没有自动大写或更正的新实例或现有实例。

Returns
TextKeyListener

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

onKeyUp

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

处理元键的释放。

Parameters
view View
content Editable
keyCode int
event KeyEvent
Returns
boolean

onSpanAdded

Added in API level 1
void onSpanAdded (Spannable s, 
                Object what, 
                int start, 
                int end)

调用此方法通知您指定的对象已附加到文本的指定范围。

Parameters
s Spannable
what Object
start int
end int

onSpanChanged

Added in API level 1
void onSpanChanged (Spannable s, 
                Object what, 
                int start, 
                int end, 
                int st, 
                int en)

调用此方法通知您指定的对象已从范围 ostart…oend重新定位到文本的新范围 nstart…nend

Parameters
s Spannable
what Object
start int
end int
st int
en int

onSpanRemoved

Added in API level 1
void onSpanRemoved (Spannable s, 
                Object what, 
                int start, 
                int end)

调用此方法通知您指定的对象已从指定的文本范围中分离。

Parameters
s Spannable
what Object
start int
end int

release

Added in API level 1
void release ()

shouldCap

Added in API level 1
boolean shouldCap (TextKeyListener.Capitalize cap, 
                CharSequence cs, 
                int off)

返回是否有意义在指定的文本中使用指定的规则自动大写指定的位置。

Parameters
cap TextKeyListener.Capitalize: the capitalization rules to consider.
cs CharSequence: the text in which an insertion is being made.
off int: the offset into that text where the insertion is being made.
Returns
boolean whether the character being inserted should be capitalized.

Hooray!