Most visited

Recently visited

Added in API level 1

DialerFilter

public class DialerFilter
extends RelativeLayout

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.RelativeLayout
         ↳ android.widget.DialerFilter


Summary

Inherited XML attributes

From class android.widget.RelativeLayout
From class android.view.ViewGroup
From class android.view.View

Constants

int DIGITS_AND_LETTERS

这种模式有两条线

int DIGITS_AND_LETTERS_NO_DIGITS

这种模式是在 DIGITS_AND_LETTERS模式下启动后,过滤器已经消除了数字匹配的所有可能性,只留下字母行

int DIGITS_AND_LETTERS_NO_LETTERS

这种模式是当在 DIGITS_AND_LETTERS模式下启动后,过滤器已经去除了字母匹配的所有可能性,只留下数字线

int DIGITS_ONLY

这种模式只有数字线

int LETTERS_ONLY

此模式只有字母行

Inherited constants

From class android.widget.RelativeLayout
From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

DialerFilter(Context context)
DialerFilter(Context context, AttributeSet attrs)

Public methods

void append(String text)
void clearText()

清除数字和过滤文本。

CharSequence getDigits()
CharSequence getFilterText()
CharSequence getLetters()
int getMode()
boolean isQwertyKeyboard()
boolean onKeyDown(int keyCode, KeyEvent event)

KeyEvent.Callback.onKeyDown()默认实现:当 KEYCODE_DPAD_CENTERKEYCODE_ENTER被释放时,如果视图被启用并且可点击,则执行按下视图。

boolean onKeyUp(int keyCode, KeyEvent event)

的默认实现 KeyEvent.Callback.onKeyUp() :当视图进行点击 KEYCODE_DPAD_CENTERKEYCODE_ENTER或者 KEYCODE_SPACE被释放。

void removeFilterWatcher(TextWatcher watcher)
void setDigitsWatcher(TextWatcher watcher)
void setFilterWatcher(TextWatcher watcher)
void setLettersWatcher(TextWatcher watcher)
void setMode(int newMode)

更改小部件的模式。

Protected methods

void onFinishInflate()

最终确定从XML扩展视图。

void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)

如果有焦点,只显示图标视图。

void onModeChange(int oldMode, int newMode)

在模式更改之后调用以给子类选择restyle等。

Inherited methods

From class android.widget.RelativeLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Constants

DIGITS_AND_LETTERS

Added in API level 1
int DIGITS_AND_LETTERS

这种模式有两条线

常数值:1(0x00000001)

DIGITS_AND_LETTERS_NO_DIGITS

Added in API level 1
int DIGITS_AND_LETTERS_NO_DIGITS

此模式是在 DIGITS_AND_LETTERS模式下启动后,过滤器已删除数字匹配的所有可能性,只留下字母行

常量值:2(0x00000002)

DIGITS_AND_LETTERS_NO_LETTERS

Added in API level 1
int DIGITS_AND_LETTERS_NO_LETTERS

此模式是在 DIGITS_AND_LETTERS模式下启动后,过滤器已删除所有字母匹配的可能性,只留下数字线

常量值:3(0x00000003)

DIGITS_ONLY

Added in API level 1
int DIGITS_ONLY

这种模式只有数字线

常量值:4(0x00000004)

LETTERS_ONLY

Added in API level 1
int LETTERS_ONLY

此模式只有字母行

常量值:5(0x00000005)

Public constructors

DialerFilter

Added in API level 1
DialerFilter (Context context)

Parameters
context Context

DialerFilter

Added in API level 1
DialerFilter (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

Public methods

append

Added in API level 1
void append (String text)

Parameters
text String

clearText

Added in API level 1
void clearText ()

清除数字和过滤文本。

getDigits

Added in API level 1
CharSequence getDigits ()

Returns
CharSequence

getFilterText

Added in API level 1
CharSequence getFilterText ()

Returns
CharSequence

getLetters

Added in API level 1
CharSequence getLetters ()

Returns
CharSequence

getMode

Added in API level 1
int getMode ()

Returns
int

isQwertyKeyboard

Added in API level 1
boolean isQwertyKeyboard ()

Returns
boolean

onKeyDown

Added in API level 1
boolean onKeyDown (int keyCode, 
                KeyEvent event)

KeyEvent.Callback.onKeyDown()默认实现:当 KEYCODE_DPAD_CENTERKEYCODE_ENTER被释放时,如果视图被启用并且可点击,则执行按下视图。

软件键盘中的按键通常不会触发这个监听器,尽管在某些情况下有些人会选择这样做。 不要依靠这个来捕捉软件按键。

Parameters
keyCode int: a key code that represents the button pressed, from KeyEvent
event KeyEvent: the KeyEvent object that defines the button action
Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyUp

Added in API level 1
boolean onKeyUp (int keyCode, 
                KeyEvent event)

的默认实现 KeyEvent.Callback.onKeyUp() :当视图进行点击 KEYCODE_DPAD_CENTERKEYCODE_ENTER或者 KEYCODE_SPACE被释放。

软件键盘中的按键通常不会触发这个监听器,尽管在某些情况下有些人会选择这样做。 不要依靠这个来捕捉软件按键。

Parameters
keyCode int: A key code that represents the button pressed, from KeyEvent.
event KeyEvent: The KeyEvent object that defines the button action.
Returns
boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

removeFilterWatcher

Added in API level 1
void removeFilterWatcher (TextWatcher watcher)

Parameters
watcher TextWatcher

setDigitsWatcher

Added in API level 1
void setDigitsWatcher (TextWatcher watcher)

Parameters
watcher TextWatcher

setFilterWatcher

Added in API level 1
void setFilterWatcher (TextWatcher watcher)

Parameters
watcher TextWatcher

setLettersWatcher

Added in API level 1
void setLettersWatcher (TextWatcher watcher)

Parameters
watcher TextWatcher

setMode

Added in API level 1
void setMode (int newMode)

更改小部件的模式。

Parameters
newMode int: The mode to switch to.

Protected methods

onFinishInflate

Added in API level 1
void onFinishInflate ()

最终确定从XML扩展视图。 这被称为通货膨胀的最后一个阶段,毕竟所有的孩子的观点已被添加。

即使子类重写onFinishInflate,他们也应该始终确保调用super方法,以便调用。

onFocusChanged

Added in API level 1
void onFocusChanged (boolean focused, 
                int direction, 
                Rect previouslyFocusedRect)

如果有焦点,只显示图标视图。

Parameters
focused boolean: True if the View has focus; false otherwise.
direction int: The direction focus has moved when requestFocus() is called to give this view focus. Values are FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, or FOCUS_BACKWARD. It may not always apply, in which case use the default.
previouslyFocusedRect Rect: The rectangle, in this view's coordinate system, of the previously focused view. If applicable, this will be passed in as finer grained information about where the focus is coming from (in addition to direction). Will be null otherwise.

onModeChange

Added in API level 1
void onModeChange (int oldMode, 
                int newMode)

在模式更改之后调用以给子类选择restyle等。

Parameters
oldMode int
newMode int

Hooray!