Most visited

Recently visited

Added in API level 1

LinkMovementMethod

public class LinkMovementMethod
extends ScrollingMovementMethod

java.lang.Object
   ↳ android.text.method.BaseMovementMethod
     ↳ android.text.method.ScrollingMovementMethod
       ↳ android.text.method.LinkMovementMethod


移动文本缓冲区中的链接并在必要时滚动的移动方法。 支持点击与DPad Center或Enter的链接。

Summary

Public constructors

LinkMovementMethod()

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 down(TextView widget, Spannable buffer)

执行向下移动动作。

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

执行移动关键动作。

boolean left(TextView widget, Spannable buffer)

执行左移动作。

boolean right(TextView widget, Spannable buffer)

执行正确的移动操作。

boolean up(TextView widget, Spannable buffer)

执行上移动作。

Inherited methods

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

Public constructors

LinkMovementMethod

Added in API level 1
LinkMovementMethod ()

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

down

Added in API level 1
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.

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.

left

Added in API level 1
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.

right

Added in API level 1
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.

up

Added in API level 1
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!