to top
Android APIs
public class

LinkMovementMethod

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

Class Overview

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
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.
[Expand]
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

public LinkMovementMethod ()

Since: API Level 1

Public Methods

public static MovementMethod getInstance ()

Since: API Level 1

public void initialize (TextView widget, Spannable text)

Since: API Level 1

public void onTakeFocus (TextView view, Spannable text, int dir)

Since: API Level 1

public boolean onTouchEvent (TextView widget, Spannable buffer, MotionEvent event)

Since: API Level 1

Protected Methods

protected boolean down (TextView widget, Spannable buffer)

Since: API Level 1

Performs a down movement action. Moves the cursor or scrolls down by one line.

Parameters
widget The text view.
buffer The text buffer.
Returns
  • True if the event was handled.

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

Since: API Level 11

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(TextView, Spannable, int, KeyEvent) calls this method once to handle an ACTION_DOWN. onKeyOther(TextView, Spannable, KeyEvent) calls this method repeatedly to handle each repetition of an ACTION_MULTIPLE.

Parameters
widget The text view.
buffer The text buffer.
keyCode The key code.
movementMetaState The keyboard meta states used for movement.
event The key event.
Returns
  • True if the event was handled.

protected boolean left (TextView widget, Spannable buffer)

Since: API Level 1

Performs a left movement action. Moves the cursor or scrolls left by one character.

Parameters
widget The text view.
buffer The text buffer.
Returns
  • True if the event was handled.

protected boolean right (TextView widget, Spannable buffer)

Since: API Level 1

Performs a right movement action. Moves the cursor or scrolls right by one character.

Parameters
widget The text view.
buffer The text buffer.
Returns
  • True if the event was handled.

protected boolean up (TextView widget, Spannable buffer)

Since: API Level 1

Performs an up movement action. Moves the cursor or scrolls up by one line.

Parameters
widget The text view.
buffer The text buffer.
Returns
  • True if the event was handled.