MovementMethod

interface MovementMethod
android.text.method.MovementMethod

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
onTouchEvent(widget: TextView!, text: Spannable!, event: MotionEvent!)

abstract Boolean

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.

abstract Boolean
onKeyDown(widget: TextView!, text: Spannable!, keyCode: Int, event: KeyEvent!)

abstract Boolean
onKeyUp(widget: TextView!, text: Spannable!, keyCode: Int, event: KeyEvent!)

abstract Boolean
onGenericMotionEvent(widget: TextView!, text: Spannable!, event: MotionEvent!)

Requires API level 12 (Android 3.1, Honeycomb)

abstract Unit
onTakeFocus(widget: TextView!, text: Spannable!, direction: Int)

abstract Unit
initialize(widget: TextView!, text: Spannable!)

abstract Boolean
onKeyOther(view: TextView!, text: Spannable!, event: KeyEvent!)

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.

abstract Boolean
onTrackballEvent(widget: TextView!, text: Spannable!, event: MotionEvent!)

Public methods

onTouchEvent

abstract fun onTouchEvent(widget: TextView!, text: Spannable!, event: MotionEvent!): Boolean

canSelectArbitrarily

abstract fun canSelectArbitrarily(): Boolean

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.

onKeyDown

abstract fun onKeyDown(widget: TextView!, text: Spannable!, keyCode: Int, event: KeyEvent!): Boolean

onKeyUp

abstract fun onKeyUp(widget: TextView!, text: Spannable!, keyCode: Int, event: KeyEvent!): Boolean

onGenericMotionEvent

added in API level 12
abstract fun onGenericMotionEvent(widget: TextView!, text: Spannable!, event: MotionEvent!): Boolean

Requires API level 12 (Android 3.1, Honeycomb)

onTakeFocus

abstract fun onTakeFocus(widget: TextView!, text: Spannable!, direction: Int): Unit

initialize

abstract fun initialize(widget: TextView!, text: Spannable!): Unit

onKeyOther

added in API level 3
abstract fun onKeyOther(view: TextView!, text: Spannable!, event: KeyEvent!): Boolean

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.
Requires API level 3 (Android 1.5, Cupcake)

onTrackballEvent

abstract fun onTrackballEvent(widget: TextView!, text: Spannable!, event: MotionEvent!): Boolean