LinkMovementMethod
public
class
LinkMovementMethod
extends ScrollingMovementMethod
java.lang.Object | |||
↳ | android.text.method.BaseMovementMethod | ||
↳ | android.text.method.ScrollingMovementMethod | ||
↳ | android.text.method.LinkMovementMethod |
A movement method that traverses links in the text buffer and scrolls if necessary. Supports clicking on links with DPad Center or Enter.
Summary
Public constructors | |
---|---|
LinkMovementMethod()
|
Public methods | |
---|---|
boolean
|
canSelectArbitrarily()
Returns true if this movement method allows arbitrary selection of any text; false if it has no selection (like a movement method that only scrolls) or a constrained selection (for example limited to links. |
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)
Performs a down movement action. |
boolean
|
handleMovementKey(TextView widget, Spannable buffer, int keyCode, int movementMetaState, KeyEvent event)
Performs a movement key action. |
boolean
|
left(TextView widget, Spannable buffer)
Performs a left movement action. |
boolean
|
right(TextView widget, Spannable buffer)
Performs a right movement action. |
boolean
|
up(TextView widget, Spannable buffer)
Performs an up movement action. |
Inherited methods | |
---|---|
Public constructors
LinkMovementMethod
public LinkMovementMethod ()
Public methods
canSelectArbitrarily
public boolean canSelectArbitrarily ()
Returns true if this movement method allows arbitrary selection of any text; false if it has no selection (like a movement method that only scrolls) or a constrained selection (for example limited to links. The "Select All" menu item is disabled if arbitrary selection is not allowed.
Returns | |
---|---|
boolean |
initialize
public void initialize (TextView widget, Spannable text)
Parameters | |
---|---|
widget |
TextView |
text |
Spannable |
onTakeFocus
public void onTakeFocus (TextView view, Spannable text, int dir)
Parameters | |
---|---|
view |
TextView |
text |
Spannable |
dir |
int |
onTouchEvent
public boolean onTouchEvent (TextView widget, Spannable buffer, MotionEvent event)
Parameters | |
---|---|
widget |
TextView |
buffer |
Spannable |
event |
MotionEvent |
Returns | |
---|---|
boolean |
Protected methods
down
protected boolean down (TextView widget, Spannable buffer)
Performs a down movement action. Moves the cursor or scrolls down by one line.
Parameters | |
---|---|
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns | |
---|---|
boolean |
True if the event was handled. |
handleMovementKey
protected boolean handleMovementKey (TextView widget, Spannable buffer, int keyCode, int movementMetaState, KeyEvent event)
Performs a movement key action.
The default implementation decodes the key down and invokes movement actions
such as down(TextView, Spannable)
and up(TextView, Spannable)
.
onKeyDown(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent)
calls this method once
to handle an KeyEvent.ACTION_DOWN
.
onKeyOther(android.widget.TextView, android.text.Spannable, android.view.KeyEvent)
calls this method repeatedly
to handle each repetition of an 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
protected boolean left (TextView widget, Spannable buffer)
Performs a left movement action. Moves the cursor or scrolls left by one character.
Parameters | |
---|---|
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns | |
---|---|
boolean |
True if the event was handled. |
right
protected boolean right (TextView widget, Spannable buffer)
Performs a right movement action. Moves the cursor or scrolls right by one character.
Parameters | |
---|---|
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns | |
---|---|
boolean |
True if the event was handled. |
up
protected boolean up (TextView widget, Spannable buffer)
Performs an up movement action. Moves the cursor or scrolls up by one line.
Parameters | |
---|---|
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns | |
---|---|
boolean |
True if the event was handled. |