Most visited

Recently visited

Added in API level 1

MovementMethod

public interface MovementMethod

android.text.method.MovementMethod
Known Indirect Subclasses


TextView提供了光标定位,滚动和文本选择功能。

TextView代表处理重要事件,轨迹球运动和触摸移动方法以用于内容导航。 该框架根据TextView的内容自动选择适当的移动方法。

该接口供框架使用; 它不应该由应用程序直接执行。

Summary

Public methods

abstract boolean canSelectArbitrarily()

如果此移动方法允许任意选择任何文本,则返回true; 如果它没有选择(如仅滚动的移动方法)或受限选择(例如限于链接),则为false。

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)

如果键监听器想要其他类型的键事件,则返回true,否则返回false并且调用者(即

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

Added in API level 1
boolean canSelectArbitrarily ()

如果此移动方法允许任意选择任何文本,则返回true; 如果它没有选择(如只有滚动的移动方法)或受限选择(例如限于链接),则为false。如果不允许任意选择,则“全选”菜单项将被禁用。

Returns
boolean

initialize

Added in API level 1
void initialize (TextView widget, 
                Spannable text)

Parameters
widget TextView
text Spannable

onGenericMotionEvent

Added in API level 12
boolean onGenericMotionEvent (TextView widget, 
                Spannable text, 
                MotionEvent event)

Parameters
widget TextView
text Spannable
event MotionEvent
Returns
boolean

onKeyDown

Added in API level 1
boolean onKeyDown (TextView widget, 
                Spannable text, 
                int keyCode, 
                KeyEvent event)

Parameters
widget TextView
text Spannable
keyCode int
event KeyEvent
Returns
boolean

onKeyOther

Added in API level 3
boolean onKeyOther (TextView view, 
                Spannable text, 
                KeyEvent event)

如果键监听器想要其他类型的键事件,则返回true,否则返回false,并且调用方(即小部件主机)将处理该键。

Parameters
view TextView
text Spannable
event KeyEvent
Returns
boolean

onKeyUp

Added in API level 1
boolean onKeyUp (TextView widget, 
                Spannable text, 
                int keyCode, 
                KeyEvent event)

Parameters
widget TextView
text Spannable
keyCode int
event KeyEvent
Returns
boolean

onTakeFocus

Added in API level 1
void onTakeFocus (TextView widget, 
                Spannable text, 
                int direction)

Parameters
widget TextView
text Spannable
direction int

onTouchEvent

Added in API level 1
boolean onTouchEvent (TextView widget, 
                Spannable text, 
                MotionEvent event)

Parameters
widget TextView
text Spannable
event MotionEvent
Returns
boolean

onTrackballEvent

Added in API level 1
boolean onTrackballEvent (TextView widget, 
                Spannable text, 
                MotionEvent event)

Parameters
widget TextView
text Spannable
event MotionEvent
Returns
boolean

Hooray!