Most visited

Recently visited

GuidedActionEditText

public class GuidedActionEditText
extends EditText implements ImeKeyMonitor

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.EditText
         ↳ android.support.v17.leanback.widget.GuidedActionEditText


自定义EditText,它满足GuidedStepFragment的IME键监控需求。

Summary

Inherited XML attributes

From class android.widget.TextView
From class android.view.View

Inherited constants

From class android.view.View

Inherited fields

From class android.view.View

Public constructors

GuidedActionEditText(Context ctx)
GuidedActionEditText(Context ctx, AttributeSet attrs)
GuidedActionEditText(Context ctx, AttributeSet attrs, int defStyleAttr)

Public methods

void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)

使用关于此视图的信息初始化 AccessibilityNodeInfo

boolean onKeyPreIme(int keyCode, KeyEvent event)

在关键事件由与视图层次关联的任何输入方法处理之前处理。

void setImeKeyListener(ImeKeyMonitor.ImeKeyListener listener)

为此编辑文本对象设置侦听器。

Protected methods

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

当视图的焦点状态改变时,由视图系统调用。

Inherited methods

From class android.widget.EditText
From class android.widget.TextView
From class android.view.View
From class java.lang.Object
From interface android.view.ViewTreeObserver.OnPreDrawListener
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource
From interface android.support.v17.leanback.widget.ImeKeyMonitor

Public constructors

GuidedActionEditText

GuidedActionEditText (Context ctx)

Parameters
ctx Context

GuidedActionEditText

GuidedActionEditText (Context ctx, 
                AttributeSet attrs)

Parameters
ctx Context
attrs AttributeSet

GuidedActionEditText

GuidedActionEditText (Context ctx, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
ctx Context
attrs AttributeSet
defStyleAttr int

Public methods

onInitializeAccessibilityNodeInfo

void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

用关于此视图的信息初始化一个AccessibilityNodeInfo 基本实现设置:

子类应该重写此方法,调用超级实现,并设置其他属性。

如果 View.AccessibilityDelegate已通过调用指定 setAccessibilityDelegate(AccessibilityDelegate)onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfo)负责处理此调用。

Parameters
info AccessibilityNodeInfo: The instance to initialize.

onKeyPreIme

boolean onKeyPreIme (int keyCode, 
                KeyEvent event)

在关键事件由与视图层次关联的任何输入方法处理之前处理。 这可以用于在IME消耗它们之前在特殊情况下截获关键事件; 一个典型的例子是处理BACK键来更新应用程序的UI,而不是让IME看到它并关闭它自己。

Parameters
keyCode int: The value in event.getKeyCode().
event KeyEvent: Description of the key event.
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.

setImeKeyListener

void setImeKeyListener (ImeKeyMonitor.ImeKeyListener listener)

为此编辑文本对象设置侦听器。 监听器的onKeyPreIme方法将从主机编辑文本的onKeyPreIme方法中调用。

Parameters
listener ImeKeyMonitor.ImeKeyListener

Protected methods

onFocusChanged

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

当视图的焦点状态改变时,由视图系统调用。 当焦点更改事件是由方向导航导致的,direction和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.

Hooray!