BaseMovementMethod
public class BaseMovementMethod
extends Object
implements MovementMethod
Known Direct Subclasses
|
Known Indirect Subclasses
|
移动方法的基类。
Summary
Public methods |
boolean |
canSelectArbitrarily() 如果此移动方法允许任意选择任何文本,则返回true; 如果它没有选择(如仅滚动的移动方法)或受限选择(例如限于链接),则为false。 |
void |
initialize(TextView widget, Spannable text) |
boolean |
onGenericMotionEvent(TextView widget, Spannable text, MotionEvent event) |
boolean |
onKeyDown(TextView widget, Spannable text, int keyCode, KeyEvent event) |
boolean |
onKeyOther(TextView widget, Spannable text, KeyEvent event) 如果键监听器想要其他类型的键事件,则返回true,否则返回false并且调用者(即 |
boolean |
onKeyUp(TextView widget, Spannable text, int keyCode, KeyEvent event) |
void |
onTakeFocus(TextView widget, Spannable text, int direction) |
boolean |
onTouchEvent(TextView widget, Spannable text, MotionEvent event) |
boolean |
onTrackballEvent(TextView widget, Spannable text, MotionEvent event) |
Protected methods |
boolean |
bottom(TextView widget, Spannable buffer) 执行底部移动动作。 |
boolean |
down(TextView widget, Spannable buffer) 执行向下移动动作。 |
boolean |
end(TextView widget, Spannable buffer) 执行结束移动操作。 |
int |
getMovementMetaState(Spannable buffer, KeyEvent event) 获取用于移动的元状态,使用文本缓冲区跟踪的修饰符以及键事件中存在的修饰符。 |
boolean |
handleMovementKey(TextView widget, Spannable buffer, int keyCode, int movementMetaState, KeyEvent event) 执行移动关键动作。 |
boolean |
home(TextView widget, Spannable buffer) 执行家庭活动行动。 |
boolean |
left(TextView widget, Spannable buffer) 执行左移动作。 |
boolean |
lineEnd(TextView widget, Spannable buffer) 执行线端移动操作。 |
boolean |
lineStart(TextView widget, Spannable buffer) 执行行开始移动操作。 |
boolean |
pageDown(TextView widget, Spannable buffer) 执行向下翻页动作。 |
boolean |
pageUp(TextView widget, Spannable buffer) 执行翻页移动操作。 |
boolean |
right(TextView widget, Spannable buffer) 执行正确的移动操作。 |
boolean |
top(TextView widget, Spannable buffer) 执行顶级移动操作。 |
boolean |
up(TextView widget, Spannable buffer) 执行上移动作。 |
Inherited methods |
From class java.lang.Object
|
From interface android.text.method.MovementMethod
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 constructors
BaseMovementMethod
BaseMovementMethod ()
Public methods
canSelectArbitrarily
boolean canSelectArbitrarily ()
如果此移动方法允许任意选择任何文本,则返回true; 如果它没有选择(如只有滚动的移动方法)或受限选择(例如限于链接),则为false。如果不允许任意选择,则“全选”菜单项将被禁用。
initialize
void initialize (TextView widget,
Spannable text)
Parameters |
widget |
TextView
|
text |
Spannable
|
onGenericMotionEvent
boolean onGenericMotionEvent (TextView widget,
Spannable text,
MotionEvent event)
Parameters |
widget |
TextView
|
text |
Spannable
|
event |
MotionEvent
|
onKeyDown
boolean onKeyDown (TextView widget,
Spannable text,
int keyCode,
KeyEvent event)
Parameters |
widget |
TextView
|
text |
Spannable
|
keyCode |
int
|
event |
KeyEvent
|
onKeyOther
boolean onKeyOther (TextView widget,
Spannable text,
KeyEvent event)
如果键监听器想要其他类型的键事件,则返回true,否则返回false,并且调用方(即小部件主机)将处理该键。
Parameters |
widget |
TextView
|
text |
Spannable
|
event |
KeyEvent
|
onKeyUp
boolean onKeyUp (TextView widget,
Spannable text,
int keyCode,
KeyEvent event)
Parameters |
widget |
TextView
|
text |
Spannable
|
keyCode |
int
|
event |
KeyEvent
|
onTakeFocus
void onTakeFocus (TextView widget,
Spannable text,
int direction)
Parameters |
widget |
TextView
|
text |
Spannable
|
direction |
int
|
onTouchEvent
boolean onTouchEvent (TextView widget,
Spannable text,
MotionEvent event)
Parameters |
widget |
TextView
|
text |
Spannable
|
event |
MotionEvent
|
onTrackballEvent
boolean onTrackballEvent (TextView widget,
Spannable text,
MotionEvent event)
Parameters |
widget |
TextView
|
text |
Spannable
|
event |
MotionEvent
|
Protected methods
bottom
boolean bottom (TextView widget,
Spannable buffer)
执行底部移动动作。 移动光标或滚动到缓冲区的底部。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
down
boolean down (TextView widget,
Spannable buffer)
执行向下移动动作。 移动光标或向下滚动一行。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
end
boolean end (TextView widget,
Spannable buffer)
执行结束移动操作。 根据插入点正在移动还是正在滚动文档,将光标或滚动移动到行的开头或文档的顶部。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
getMovementMetaState
int getMovementMetaState (Spannable buffer,
KeyEvent event)
获取用于移动的元状态,使用文本缓冲区跟踪的修饰符以及键事件中存在的修饰符。 移动元状态排除锁定修饰符或SHIFT键的状态,因为它们不被移动动作使用(但可用于选择)。
Parameters |
buffer |
Spannable : The text buffer. |
event |
KeyEvent : The key event. |
Returns |
int |
The keyboard meta states used for movement. |
handleMovementKey
boolean handleMovementKey (TextView widget,
Spannable buffer,
int keyCode,
int movementMetaState,
KeyEvent event)
执行移动关键动作。 默认实现将密钥解码并调用移动操作,如down(TextView, Spannable)
和up(TextView, Spannable)
。 onKeyDown(TextView, Spannable, int, KeyEvent)
调用此方法一次来处理ACTION_DOWN
。 onKeyOther(TextView, Spannable, KeyEvent)
重复调用此方法来处理每个重复的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. |
home
boolean home (TextView widget,
Spannable buffer)
执行家庭活动行动。 根据插入点正在移动还是正在滚动文档,将光标或滚动移动到行的开头或文档的顶部。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
left
boolean left (TextView widget,
Spannable buffer)
执行左移动作。 移动光标或向左滚动一个字符。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
lineEnd
boolean lineEnd (TextView widget,
Spannable buffer)
执行线端移动操作。 将光标或滚动移动到行的末尾。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
lineStart
boolean lineStart (TextView widget,
Spannable buffer)
执行行开始移动操作。 将光标或滚动移动到行的开头。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
pageDown
boolean pageDown (TextView widget,
Spannable buffer)
执行向下翻页动作。 移动光标或向下滚动一页。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
pageUp
boolean pageUp (TextView widget,
Spannable buffer)
执行翻页移动操作。 移动光标或向上滚动一页。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
right
boolean right (TextView widget,
Spannable buffer)
执行正确的移动操作。 移动光标或向右滚动一个字符。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
top
boolean top (TextView widget,
Spannable buffer)
执行顶级移动操作。 将光标或滚动移动到缓冲区的顶部。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |
up
boolean up (TextView widget,
Spannable buffer)
执行上移动作。 移动光标或向上滚动一行。
Parameters |
widget |
TextView : The text view. |
buffer |
Spannable : The text buffer. |
Returns |
boolean |
True if the event was handled. |