Android APIs
public class

ArrowKeyMovementMethod

extends BaseMovementMethod
implements MovementMethod
java.lang.Object
   ↳ android.text.method.BaseMovementMethod
     ↳ android.text.method.ArrowKeyMovementMethod

Class Overview

A movement method that provides cursor movement and selection. Supports displaying the context menu on DPad Center.

Summary

Public Constructors
ArrowKeyMovementMethod()
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 bottom(TextView widget, Spannable buffer)
Performs a bottom movement action.
boolean down(TextView widget, Spannable buffer)
Performs a down movement action.
boolean end(TextView widget, Spannable buffer)
Performs an end movement action.
boolean handleMovementKey(TextView widget, Spannable buffer, int keyCode, int movementMetaState, KeyEvent event)
Performs a movement key action.
boolean home(TextView widget, Spannable buffer)
Performs a home movement action.
boolean left(TextView widget, Spannable buffer)
Performs a left movement action.
boolean lineEnd(TextView widget, Spannable buffer)
Performs a line-end movement action.
boolean lineStart(TextView widget, Spannable buffer)
Performs a line-start movement action.
boolean pageDown(TextView widget, Spannable buffer)
Performs a page-down movement action.
boolean pageUp(TextView widget, Spannable buffer)
Performs a page-up movement action.
boolean right(TextView widget, Spannable buffer)
Performs a right movement action.
boolean top(TextView widget, Spannable buffer)
Performs a top movement action.
boolean up(TextView widget, Spannable buffer)
Performs an up movement action.
[Expand]
Inherited Methods
From class android.text.method.BaseMovementMethod
From class java.lang.Object
From interface android.text.method.MovementMethod

Public Constructors

public ArrowKeyMovementMethod ()

Added in API level 1

Public Methods

public boolean canSelectArbitrarily ()

Added in API level 1

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

public static MovementMethod getInstance ()

Added in API level 1

Returns
MovementMethod

public void initialize (TextView widget, Spannable text)

Added in API level 1

Parameters
widget TextView
text Spannable

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

Added in API level 1

Parameters
view TextView
text Spannable
dir int

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

Added in API level 1

Parameters
widget TextView
buffer Spannable
event MotionEvent
Returns
boolean

Protected Methods

protected boolean bottom (TextView widget, Spannable buffer)

Added in API level 11

Performs a bottom movement action. Moves the cursor or scrolls to the bottom of the buffer.

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

protected boolean down (TextView widget, Spannable buffer)

Added in API level 11

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.

protected boolean end (TextView widget, Spannable buffer)

Added in API level 11

Performs an end movement action. Moves the cursor or scrolls to the start of the line or to the top of the document depending on whether the insertion point is being moved or the document is being scrolled.

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

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

Added in 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 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.

protected boolean home (TextView widget, Spannable buffer)

Added in API level 11

Performs a home movement action. Moves the cursor or scrolls to the start of the line or to the top of the document depending on whether the insertion point is being moved or the document is being scrolled.

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

protected boolean left (TextView widget, Spannable buffer)

Added in API level 11

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.

protected boolean lineEnd (TextView widget, Spannable buffer)

Added in API level 11

Performs a line-end movement action. Moves the cursor or scrolls to the end of the line.

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

protected boolean lineStart (TextView widget, Spannable buffer)

Added in API level 11

Performs a line-start movement action. Moves the cursor or scrolls to the start of the line.

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

protected boolean pageDown (TextView widget, Spannable buffer)

Added in API level 11

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

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

protected boolean pageUp (TextView widget, Spannable buffer)

Added in API level 11

Performs a page-up movement action. Moves the cursor or scrolls up by one page.

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

protected boolean right (TextView widget, Spannable buffer)

Added in API level 11

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.

protected boolean top (TextView widget, Spannable buffer)

Added in API level 11

Performs a top movement action. Moves the cursor or scrolls to the top of the buffer.

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

protected boolean up (TextView widget, Spannable buffer)

Added in API level 11

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.