Most visited

Recently visited

Added in API level 1

ArrowKeyMovementMethod

public class ArrowKeyMovementMethod
extends BaseMovementMethod implements MovementMethod

java.lang.Object
   ↳ android.text.method.BaseMovementMethod
     ↳ android.text.method.ArrowKeyMovementMethod


提供光标移动和选择的移动方法。 支持在DPad Center上显示上下文菜单。

Summary

Public constructors

ArrowKeyMovementMethod()

Public methods

boolean canSelectArbitrarily()

如果此移动方法允许任意选择任何文本,则返回true; 如果它没有选择(如仅滚动的移动方法)或受限选择(例如限于链接),则为false。

static MovementMethod getInstance()
void initialize(TextView widget, Spannable text)
void onTakeFocus(TextView view, Spannable text, int dir)
boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event)

Protected methods

boolean bottom(TextView widget, Spannable buffer)

执行底部移动动作。

boolean down(TextView widget, Spannable buffer)

执行向下移动动作。

boolean end(TextView widget, Spannable buffer)

执行结束移动操作。

boolean handleMovementKey(TextView widget, Spannable buffer, int keyCode, int movementMetaState, KeyEvent event)

执行移动关键动作。

boolean home(TextView widget, Spannable buffer)

执行家庭活动行动。

boolean left(TextView widget, Spannable buffer)

执行左移动作。

boolean lineEnd(TextView widget, Spannable buffer)

执行线端移动操作。

boolean lineStart(TextView widget, Spannable buffer)

执行行开始移动操作。

boolean pageDown(TextView widget, Spannable buffer)

执行向下翻页动作。

boolean pageUp(TextView widget, Spannable buffer)

执行翻页移动操作。

boolean right(TextView widget, Spannable buffer)

执行正确的移动操作。

boolean top(TextView widget, Spannable buffer)

执行顶级移动操作。

boolean up(TextView widget, Spannable buffer)

执行上移动作。

Inherited methods

From class android.text.method.BaseMovementMethod
From class java.lang.Object
From interface android.text.method.MovementMethod

Public constructors

ArrowKeyMovementMethod

Added in API level 1
ArrowKeyMovementMethod ()

Public methods

canSelectArbitrarily

Added in API level 1
boolean canSelectArbitrarily ()

如果此移动方法允许任意选择任何文本,则返回true; 如果它没有选择(如只有滚动的移动方法)或受限选择(例如限于链接),则为false。如果不允许任意选择,则“全选”菜单项将被禁用。

Returns
boolean

getInstance

Added in API level 1
MovementMethod getInstance ()

Returns
MovementMethod

initialize

Added in API level 1
void initialize (TextView widget, 
                Spannable text)

Parameters
widget TextView
text Spannable

onTakeFocus

Added in API level 1
void onTakeFocus (TextView view, 
                Spannable text, 
                int dir)

Parameters
view TextView
text Spannable
dir int

onTouchEvent

Added in API level 1
boolean onTouchEvent (TextView widget, 
                Spannable buffer, 
                MotionEvent event)

Parameters
widget TextView
buffer Spannable
event MotionEvent
Returns
boolean

Protected methods

bottom

Added in API level 11
boolean bottom (TextView widget, 
                Spannable buffer)

执行底部移动动作。 移动光标或滚动到缓冲区的底部。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

down

Added in API level 11
boolean down (TextView widget, 
                Spannable buffer)

执行向下移动动作。 移动光标或向下滚动一行。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

end

Added in API level 11
boolean end (TextView widget, 
                Spannable buffer)

执行结束移动操作。 根据插入点正在移动还是正在滚动文档,将光标或滚动移动到行的开头或文档的顶部。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

handleMovementKey

Added in API level 11
boolean handleMovementKey (TextView widget, 
                Spannable buffer, 
                int keyCode, 
                int movementMetaState, 
                KeyEvent event)

执行移动关键动作。 默认实现将该键解码并调用移动动作,例如down(TextView, Spannable)up(TextView, Spannable) onKeyDown(TextView, Spannable, int, KeyEvent)调用此方法一次来处理ACTION_DOWN onKeyOther(TextView, Spannable, KeyEvent)重复调用此方法来处理每个重复的ACTION_MULTIPLE

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
keyCode int: The key code.
movementMetaState int: The keyboard meta states used for movement.
event KeyEvent: The key event.
Returns
boolean True if the event was handled.

home

Added in API level 11
boolean home (TextView widget, 
                Spannable buffer)

执行家庭活动行动。 根据插入点正在移动还是正在滚动文档,将光标或滚动移动到行的开头或文档的顶部。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

left

Added in API level 11
boolean left (TextView widget, 
                Spannable buffer)

执行左移动作。 移动光标或向左滚动一个字符。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

lineEnd

Added in API level 11
boolean lineEnd (TextView widget, 
                Spannable buffer)

执行线端移动操作。 将光标或滚动移动到行的末尾。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

lineStart

Added in API level 11
boolean lineStart (TextView widget, 
                Spannable buffer)

执行行开始移动操作。 将光标或滚动移动到行的开头。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

pageDown

Added in API level 11
boolean pageDown (TextView widget, 
                Spannable buffer)

执行向下翻页动作。 移动光标或向下滚动一页。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

pageUp

Added in API level 11
boolean pageUp (TextView widget, 
                Spannable buffer)

执行翻页移动操作。 移动光标或向上滚动一页。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

right

Added in API level 11
boolean right (TextView widget, 
                Spannable buffer)

执行正确的移动操作。 移动光标或向右滚动一个字符。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

top

Added in API level 11
boolean top (TextView widget, 
                Spannable buffer)

执行顶级移动操作。 将光标或滚动移动到缓冲区的顶部。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

up

Added in API level 11
boolean up (TextView widget, 
                Spannable buffer)

执行上移动作。 移动光标或向上滚动一行。

Parameters
widget TextView: The text view.
buffer Spannable: The text buffer.
Returns
boolean True if the event was handled.

Hooray!