Stay organized with collections Save and categorize content based on your preferences. MovementMethod
public interface MovementMethod
| android.text.method.MovementMethod |
Known indirect subclasses |
Provides cursor positioning, scrolling and text selection functionality in a TextView.
The TextView delegates handling of key events, trackball motions and touches to the movement method for purposes of content navigation. The framework automatically selects an appropriate movement method based on the content of the TextView.
This interface is intended for use by the framework; it should not be implemented directly by applications.
Summary
Public methods |
abstract 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. |
abstract void | initialize(TextView widget, Spannable text) |
abstract boolean | onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) |
abstract boolean | onKeyDown(TextView widget, Spannable text, int keyCode, KeyEvent event) |
abstract boolean | onKeyOther(TextView view, Spannable text, KeyEvent event) If the key listener wants to other kinds of key events, return true, otherwise return false and the caller (i.e. |
abstract boolean | onKeyUp(TextView widget, Spannable text, int keyCode, KeyEvent event) |
abstract void | onTakeFocus(TextView widget, Spannable text, int direction) |
abstract boolean | onTouchEvent(TextView widget, Spannable text, MotionEvent event) |
abstract boolean | onTrackballEvent(TextView widget, Spannable text, MotionEvent event) |
Public methods
canSelectArbitrarily
public abstract 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.
initialize
public abstract void initialize (TextView widget, Spannable text)
| Parameters |
widget | TextView |
text | Spannable |
onGenericMotionEvent
public abstract boolean onGenericMotionEvent (TextView widget, Spannable text, MotionEvent event)
| Parameters |
widget | TextView |
text | Spannable |
event | MotionEvent |
onKeyDown
public abstract boolean onKeyDown (TextView widget, Spannable text, int keyCode, KeyEvent event)
| Parameters |
widget | TextView |
text | Spannable |
keyCode | int |
event | KeyEvent |
onKeyOther
public abstract boolean onKeyOther (TextView view, Spannable text, KeyEvent event)
If the key listener wants to other kinds of key events, return true, otherwise return false and the caller (i.e. the widget host) will handle the key.
| Parameters |
view | TextView |
text | Spannable |
event | KeyEvent |
onKeyUp
public abstract boolean onKeyUp (TextView widget, Spannable text, int keyCode, KeyEvent event)
| Parameters |
widget | TextView |
text | Spannable |
keyCode | int |
event | KeyEvent |
onTakeFocus
public abstract void onTakeFocus (TextView widget, Spannable text, int direction)
| Parameters |
widget | TextView |
text | Spannable |
direction | int |
onTouchEvent
public abstract boolean onTouchEvent (TextView widget, Spannable text, MotionEvent event)
| Parameters |
widget | TextView |
text | Spannable |
event | MotionEvent |
onTrackballEvent
public abstract boolean onTrackballEvent (TextView widget, Spannable text, MotionEvent event)
| Parameters |
widget | TextView |
text | Spannable |
event | MotionEvent |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]