public final class AccessibilityEvent
extends AccessibilityRecord
implements Parcelable
java.lang.Object | ||
↳ | android.view.accessibility.AccessibilityRecord | |
↳ | android.view.accessibility.AccessibilityEvent |
此类表示在用户界面中出现显着事件时由系统发送的可访问性事件。 例如,当点击Button
时, View
被集中,等等。
可访问性事件由单个视图触发,该视图使用其状态的数据填充事件,并从其父级请求将事件发送给感兴趣的各方。 父母可以选择为自己添加一个AccessibilityRecord
,然后向其父母派发类似的请求。 家长也可以选择不尊重发送活动的请求。 可访问性事件由视图树中最顶层的视图发送。 因此, AccessibilityService
可以浏览可访问性事件中的所有记录,以获取有关事件触发的上下文的更多信息。
可访问性事件的主要目的是为AccessibilityService
公开足够的信息以向用户提供有意义的反馈。 然而,有时候,无障碍服务可能需要更多的上下文信息,然后才需要付费。 在这种情况下,服务可以获得可以用于浏览窗口内容的事件源AccessibilityNodeInfo
(View状态的快照)。 请注意,必须明确要求访问事件源的权限,因此窗口内容。 有关更多详细信息,请参阅AccessibilityService
。 如果辅助功能服务未请求检索窗口内容,则该事件不会包含对其源的引用。 对于类型为TYPE_NOTIFICATION_STATE_CHANGED
的事件,源也不可用。
这个类表示不同的语义不同的可访问性事件类型。 每种事件类型都有一组关联的属性。 换句话说,每个事件类型都是通过该类所公开的属性的子集来表征的。 对于每个事件类型,都有一个在此类中定义的相应常量。 遵循事件类型及其相关属性的规范:
有关创建和处理AccessibilityEvents的更多信息,请阅读 Accessibility开发人员指南。
查看类型
点击查看 -代表点击一个的事件View
像Button
, CompoundButton
,等等。
类型: TYPE_VIEW_CLICKED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.isPassword()
- Whether the source is password.isChecked()
- Whether the source is checked.getContentDescription()
- The content description of the source.getScrollX()
- The offset of the source left edge in pixels (without descendants of AdapterView).getScrollY()
- The offset of the source top edge in pixels (without descendants of AdapterView).getFromIndex()
- The zero based index of the first visible item of the source, inclusive (for descendants of AdapterView).getToIndex()
- The zero based index of the last visible item of the source, inclusive (for descendants of AdapterView).getItemCount()
- The total items of the source (for descendants of AdapterView).查看长点击 -表示长时间点击的一个事件View
像Button
, CompoundButton
,等
类型: TYPE_VIEW_LONG_CLICKED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.isPassword()
- Whether the source is password.isChecked()
- Whether the source is checked.getContentDescription()
- The content description of the source.getScrollX()
- The offset of the source left edge in pixels (without descendants of AdapterView).getScrollY()
- The offset of the source top edge in pixels (without descendants of AdapterView).getFromIndex()
- The zero based index of the first visible item of the source, inclusive (for descendants of AdapterView).getToIndex()
- The zero based index of the last visible item of the source, inclusive (for descendants of AdapterView).getItemCount()
- The total items of the source (for descendants of AdapterView).选择视图 - 表示通常在AdapterView
的上下文中选择项目的事件。
类型: TYPE_VIEW_SELECTED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.isPassword()
- Whether the source is password.isChecked()
- Whether the source is checked.getItemCount()
- The number of selectable items of the source.getCurrentItemIndex()
- The currently selected item index.getContentDescription()
- The content description of the source.getScrollX()
- The offset of the source left edge in pixels (without descendants of AdapterView).getScrollY()
- The offset of the source top edge in pixels (without descendants of AdapterView).getFromIndex()
- The zero based index of the first visible item of the source, inclusive (for descendants of AdapterView).getToIndex()
- The zero based index of the last visible item of the source, inclusive (for descendants of AdapterView).getItemCount()
- The total items of the source (for descendants of AdapterView).集中观看 - 代表聚焦View
的事件。
类型: TYPE_VIEW_FOCUSED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.isPassword()
- Whether the source is password.isChecked()
- Whether the source is checked.getItemCount()
- The number of focusable items on the screen.getCurrentItemIndex()
- The currently focused item index.getContentDescription()
- The content description of the source.getScrollX()
- The offset of the source left edge in pixels (without descendants of AdapterView).getScrollY()
- The offset of the source top edge in pixels (without descendants of AdapterView).getFromIndex()
- The zero based index of the first visible item of the source, inclusive (for descendants of AdapterView).getToIndex()
- The zero based index of the last visible item of the source, inclusive (for descendants of AdapterView).getItemCount()
- The total items of the source (for descendants of AdapterView).查看文本已更改 - 表示更改EditText
文本的EditText
。
类型: TYPE_VIEW_TEXT_CHANGED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source.isEnabled()
- Whether the source is enabled.isPassword()
- Whether the source is password.isChecked()
- Whether the source is checked.getFromIndex()
- The text change start index.getAddedCount()
- The number of added characters.getRemovedCount()
- The number of removed characters.getBeforeText()
- The text of the source before the change.getContentDescription()
- The content description of the source.查看文本选择已更改 - 表示更改EditText
的文本选择事件。
类型: TYPE_VIEW_TEXT_SELECTION_CHANGED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source.isPassword()
- Whether the source is password.getFromIndex()
- The selection start index.getToIndex()
- The selection end index.getItemCount()
- The length of the source text.isEnabled()
- Whether the source is enabled.getContentDescription()
- The content description of the source.TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getMovementGranularity()
- Sets the granularity at which a view's text was traversed.getText()
- The text of the source's sub-tree.getFromIndex()
- The start the text that was skipped over in this movement. This is the starting point when moving forward through the text, but not when moving back.getToIndex()
- The end of the text that was skipped over in this movement. This is the ending point when moving forward through the text, but not when moving back.isPassword()
- Whether the source is password.isEnabled()
- Whether the source is enabled.getContentDescription()
- The content description of the source.getMovementGranularity()
- Sets the granularity at which a view's text was traversed.getAction()
- Gets traversal action which specifies the direction.查看滚动 - 表示滚动视图的事件。 如果源是AdapterView
的后代,则根据可见项目(第一个可见项目,最后一个可见项目和总项目)报告滚动,因为源代码不知道其像素大小,因为它的适配器负责创建观点。 在所有其他情况下,滚动分别报告为X轴和Y轴上的当前滚动以及以像素为单位的源高度。
类型: TYPE_VIEW_SCROLLED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.getContentDescription()
- The content description of the source.getScrollX()
- The offset of the source left edge in pixels (without descendants of AdapterView).getScrollY()
- The offset of the source top edge in pixels (without descendants of AdapterView).getFromIndex()
- The zero based index of the first visible item of the source, inclusive (for descendants of AdapterView).getToIndex()
- The zero based index of the last visible item of the source, inclusive (for descendants of AdapterView).getItemCount()
- The total items of the source (for descendants of AdapterView).View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
, hence the event source
View
and the sub-tree rooted at it will not receive calls to
View.onPopulateAccessibilityEvent(AccessibilityEvent)
. The preferred way to add text content to such events is by setting the
contentDescription
of the source view.
过渡类型
窗口状态改变 -表示的打开事件PopupWindow
, Menu
, Dialog
等
类型: TYPE_WINDOW_STATE_CHANGED
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.窗口内容已更改 - 表示窗口内容发生更改。 此更改可以添加/删除视图,更改视图大小等。
注意:此事件仅针对最后一个辅助功能事件的窗口源与TYPE_NOTIFICATION_STATE_CHANGED
不同,其目的是通知客户端用户交互窗口的内容已更改。
类型: TYPE_WINDOW_CONTENT_CHANGED
属性:
getEventType()
- The type of the event.getContentChangeTypes()
- The type of content changes.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
, hence the event source
View
and the sub-tree rooted at it will not receive calls to
View.onPopulateAccessibilityEvent(AccessibilityEvent)
. The preferred way to add text content to such events is by setting the
contentDescription
of the source view.
Windows已更改 - 代表屏幕上显示的窗口发生更改,如窗口出现,窗口消失,窗口大小更改,窗口层更改等等。
类型: TYPE_WINDOWS_CHANGED
属性:
getEventType()
- The type of the event.getEventTime()
- The event time.AccessibilityWindowInfo
for the window source of the event via
getSource()
to get the source node on which then call
AccessibilityNodeInfo.getWindow()
to get the window. Also all windows on the screen can be retrieved by a call to
android.accessibilityservice.AccessibilityService.getWindows()
.
通知类型
通知状态已更改 - 表示显示Notification
的事件。
类型: TYPE_NOTIFICATION_STATE_CHANGED
属性:
getEventType()
- The type of the event.getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getParcelableData()
- The posted Notification
.getText()
- Text for providing more context.View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)
, hence the event source
View
and the sub-tree rooted at it will not receive calls to
View.onPopulateAccessibilityEvent(AccessibilityEvent)
. The preferred way to add text content to such events is by setting the
contentDescription
of the source view.
勘探类型
查看悬停输入 - 表示开始悬停在View
上的View
。 可以通过触摸或通过定位设备浏览屏幕来生成悬停。
类型: TYPE_VIEW_HOVER_ENTER
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.getContentDescription()
- The content description of the source.getScrollX()
- The offset of the source left edge in pixels (without descendants of AdapterView).getScrollY()
- The offset of the source top edge in pixels (without descendants of AdapterView).getFromIndex()
- The zero based index of the first visible item of the source, inclusive (for descendants of AdapterView).getToIndex()
- The zero based index of the last visible item of the source, inclusive (for descendants of AdapterView).getItemCount()
- The total items of the source (for descendants of AdapterView).View
. The hover may be generated via exploring the screen by touch or via a pointing device.
TYPE_VIEW_HOVER_EXIT
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the source's sub-tree.isEnabled()
- Whether the source is enabled.getContentDescription()
- The content description of the source.getScrollX()
- The offset of the source left edge in pixels (without descendants of AdapterView).getScrollY()
- The offset of the source top edge in pixels (without descendants of AdapterView).getFromIndex()
- The zero based index of the first visible item of the source, inclusive (for descendants of AdapterView).getToIndex()
- The zero based index of the last visible item of the source, inclusive (for descendants of AdapterView).getItemCount()
- The total items of the source (for descendants of AdapterView).触摸互动开始 - 表示开始触摸互动的事件,即用户开始触摸屏幕。
类型: TYPE_TOUCH_INTERACTION_START
属性:
getEventType()
- The type of the event.触摸交互结束 - 表示结束触摸交互的事件,即用户停止触摸屏幕。
类型: TYPE_TOUCH_INTERACTION_END
属性:
getEventType()
- The type of the event.触摸探索手势开始 - 表示开始触摸探索手势的事件。
类型: TYPE_TOUCH_EXPLORATION_GESTURE_START
属性:
getEventType()
- The type of the event.触摸探索手势结束 - 表示结束触摸探索手势的事件。
类型: TYPE_TOUCH_EXPLORATION_GESTURE_END
属性:
getEventType()
- The type of the event.触摸手势检测开始 - 表示开始用户手势检测的事件。
类型: TYPE_GESTURE_DETECTION_START
属性:
getEventType()
- The type of the event.触摸手势检测结束 - 表示结束用户手势检测的事件。
类型: TYPE_GESTURE_DETECTION_END
属性:
getEventType()
- The type of the event.其他类型
公告 - 代表发布公告的申请事件。 通常这个公告与某种上下文变化有关,对于这种变化,没有任何代表UI过渡的事件是合适的。 例如,在书中宣布新页面。
类型: TYPE_ANNOUNCEMENT
属性:
getEventType()
- The type of the event.getSource()
- The source info (for registered clients).getClassName()
- The class name of the source.getPackageName()
- The package name of the source.getEventTime()
- The event time.getText()
- The text of the announcement.isEnabled()
- Whether the source is enabled.安全说明
由于事件包含其来源隐私文本,因泄漏敏感信息(如密码)可能会受到影响。 为了解决这个问题,响应于操纵密码字段而触发的任何事件不包含密码的文本。
Inherited constants |
---|
From interface android.os.Parcelable
|
Fields |
|
---|---|
public static final Creator<AccessibilityEvent> |
CREATOR |
Public methods |
|
---|---|
void |
appendRecord(AccessibilityRecord record) 追加 |
int |
describeContents() 描述此Parcelable实例的封送表示中包含的特殊对象的种类。 |
static String |
eventTypeToString(int eventType) 返回事件类型的字符串表示形式。 |
int |
getAction() 获取触发此事件的已执行操作。 |
int |
getContentChangeTypes() 获取由 |
long |
getEventTime() 获取此事件发送的时间。 |
int |
getEventType() 获取事件类型。 |
int |
getMovementGranularity() 获取遍历的移动粒度。 |
CharSequence |
getPackageName() 获取源的包名称。 |
AccessibilityRecord |
getRecord(int index) 获取给定索引处的记录。 |
int |
getRecordCount() 获取事件中包含的记录数。 |
void |
initFromParcel(Parcel parcel) 从 |
static AccessibilityEvent |
obtain(AccessibilityEvent event) 如果可用或创建新实例,则返回缓存实例。 |
static AccessibilityEvent |
obtain() 如果可用或返回实例,则返回缓存的实例。 |
static AccessibilityEvent |
obtain(int eventType) 如果可用,则返回缓存实例,或者使用其类型属性集实例化新实例。 |
void |
recycle() 回收一个实例以重用。 |
void |
setAction(int action) 设置触发此事件的已执行操作。 |
void |
setContentChangeTypes(int changeTypes) 设置由 |
void |
setEventTime(long eventTime) 设置此事件发送的时间。 |
void |
setEventType(int eventType) 设置事件类型。 |
void |
setMovementGranularity(int granularity) 设置已遍历的移动粒度。 |
void |
setPackageName(CharSequence packageName) 设置源的包名称。 |
String |
toString() 返回对象的字符串表示形式。 |
void |
writeToParcel(Parcel parcel, int flags) 将此对象平铺到一个包裹中。 |
Inherited methods |
|
---|---|
From class android.view.accessibility.AccessibilityRecord
|
|
From class java.lang.Object
|
|
From interface android.os.Parcelable
|
int CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION
更改 TYPE_WINDOW_CONTENT_CHANGED
事件的类型:节点的内容描述已更改。
常量值:4(0x00000004)
int CONTENT_CHANGE_TYPE_SUBTREE
更改 TYPE_WINDOW_CONTENT_CHANGED
事件的类型:已添加或删除以源节点为根的子树中的节点。
常数值:1(0x00000001)
int CONTENT_CHANGE_TYPE_TEXT
更改 TYPE_WINDOW_CONTENT_CHANGED
事件的类型:节点的文本已更改。
常量值:2(0x00000002)
int CONTENT_CHANGE_TYPE_UNDEFINED
更改 TYPE_WINDOW_CONTENT_CHANGED
事件的类型:更改的类型未定义。
常量值:0(0x00000000)
int TYPES_ALL_MASK
面膜为 AccessibilityEvent
所有类型。
也可以看看:
TYPE_VIEW_CLICKED
TYPE_VIEW_LONG_CLICKED
TYPE_VIEW_SELECTED
TYPE_VIEW_FOCUSED
TYPE_VIEW_TEXT_CHANGED
TYPE_WINDOW_STATE_CHANGED
TYPE_NOTIFICATION_STATE_CHANGED
TYPE_VIEW_HOVER_ENTER
TYPE_VIEW_HOVER_EXIT
TYPE_TOUCH_EXPLORATION_GESTURE_START
TYPE_TOUCH_EXPLORATION_GESTURE_END
TYPE_WINDOW_CONTENT_CHANGED
TYPE_VIEW_SCROLLED
TYPE_VIEW_TEXT_SELECTION_CHANGED
TYPE_ANNOUNCEMENT
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
TYPE_GESTURE_DETECTION_START
TYPE_GESTURE_DETECTION_END
TYPE_TOUCH_INTERACTION_START
TYPE_TOUCH_INTERACTION_END
TYPE_WINDOWS_CHANGED
TYPE_VIEW_CONTEXT_CLICKED
常量值:-1(0xffffffff)
int TYPE_ASSIST_READING_CONTEXT
代表当前正在阅读用户屏幕上下文的助理事件。
常量值:16777216(0x01000000)
int TYPE_GESTURE_DETECTION_END
代表结束手势检测的事件。
常量值:524288(0x00080000)
int TYPE_GESTURE_DETECTION_START
代表开始手势检测事件。
常量值:262144(0x00040000)
int TYPE_NOTIFICATION_STATE_CHANGED
代表显示 Notification
的事件。
常量值:64(0x00000040)
int TYPE_TOUCH_EXPLORATION_GESTURE_END
表示结束触摸探索手势的事件。
常量值:1024(0x00000400)
int TYPE_TOUCH_EXPLORATION_GESTURE_START
表示开始触摸探索手势的事件。
常量值:512(0x00000200)
int TYPE_TOUCH_INTERACTION_END
表示用户结束触摸屏幕的事件。
常量值:2097152(0x00200000)
int TYPE_TOUCH_INTERACTION_START
表示用户开始触摸屏幕的事件。
常量值:1048576(0x00100000)
int TYPE_VIEW_ACCESSIBILITY_FOCUSED
代表获得可访问性焦点的事件。
常量值:32768(0x00008000)
int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED
表示清除可访问性焦点事件。
常量值:65536(0x00010000)
int TYPE_VIEW_CLICKED
代表点击的一个事件 View
像 Button
, CompoundButton
,等等。
常数值:1(0x00000001)
int TYPE_VIEW_CONTEXT_CLICKED
表示点击 View
上下文的事件。
常量值:8388608(0x00800000)
int TYPE_VIEW_HOVER_ENTER
代表悬停输入超过 View
。
常量值:128(0x00000080)
int TYPE_VIEW_HOVER_EXIT
代表 View
上的悬停退出事件。
常量值:256(0x00000100)
int TYPE_VIEW_LONG_CLICKED
表示长时间点击的一个事件 View
像 Button
, CompoundButton
,等等。
常量值:2(0x00000002)
int TYPE_VIEW_SELECTED
代表通常在 AdapterView
的上下文中选择项目的事件。
常量值:4(0x00000004)
int TYPE_VIEW_TEXT_SELECTION_CHANGED
常量值:8192(0x00002000)
int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
表示以给定的移动粒度遍历视图文本的事件。
常量值:131072(0x00020000)
int TYPE_WINDOWS_CHANGED
代表屏幕上显示的窗口中的事件更改。
常量值:4194304(0x00400000)
int TYPE_WINDOW_CONTENT_CHANGED
表示更改窗口内容的事件,更具体地说是以事件源为根的子树。
常量值:2048(0x00000800)
int TYPE_WINDOW_STATE_CHANGED
代表打开的情况下 PopupWindow
, Menu
, Dialog
,等等。
常量值:32(0x00000020)
void appendRecord (AccessibilityRecord record)
将 AccessibilityRecord
附加到事件记录的末尾。
Parameters | |
---|---|
record |
AccessibilityRecord : The record to append. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
int describeContents ()
描述此Parcelable实例的封送表示中包含的特殊对象的种类。 例如,如果对象将在writeToParcel(Parcel, int)
的输出中包含writeToParcel(Parcel, int)
,则此方法的返回值必须包含CONTENTS_FILE_DESCRIPTOR
位。
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
String eventTypeToString (int eventType)
返回事件类型的字符串表示形式。 例如, TYPE_VIEW_CLICKED
由字符串TYPE_VIEW_CLICKED表示。
Parameters | |
---|---|
eventType |
int : The event type |
Returns | |
---|---|
String |
The string representation. |
int getContentChangeTypes ()
获取由TYPE_WINDOW_CONTENT_CHANGED
事件发送的更改类型的位掩码。 单个事件可能代表多种更改类型。
Returns | |
---|---|
int |
The bit mask of change types. One or more of: |
int getMovementGranularity ()
获取遍历的移动粒度。
Returns | |
---|---|
int |
The granularity. |
CharSequence getPackageName ()
获取源的包名称。
Returns | |
---|---|
CharSequence |
The package name. |
AccessibilityRecord getRecord (int index)
获取给定索引处的记录。
Parameters | |
---|---|
index |
int : The index. |
Returns | |
---|---|
AccessibilityRecord |
The record at the specified index. |
int getRecordCount ()
获取事件中包含的记录数。
Returns | |
---|---|
int |
The number of records. |
void initFromParcel (Parcel parcel)
从 Parcel
创建一个新实例。
Parameters | |
---|---|
parcel |
Parcel : A parcel containing the state of a AccessibilityEvent . |
AccessibilityEvent obtain (AccessibilityEvent event)
如果可用或创建新实例,则返回缓存实例。 返回的实例从给定的event
初始化。
Parameters | |
---|---|
event |
AccessibilityEvent : The other event. |
Returns | |
---|---|
AccessibilityEvent |
An instance. |
AccessibilityEvent obtain ()
如果可用或返回实例,则返回缓存的实例。
Returns | |
---|---|
AccessibilityEvent |
An instance. |
AccessibilityEvent obtain (int eventType)
如果可用,则返回缓存实例,或者使用其类型属性集实例化新实例。
Parameters | |
---|---|
eventType |
int : The event type. |
Returns | |
---|---|
AccessibilityEvent |
An instance. |
void recycle ()
回收一个实例以重用。
注意:调用此函数后,请勿触摸对象。
Throws | |
---|---|
IllegalStateException |
If the event is already recycled. |
void setAction (int action)
设置触发此事件的已执行操作。
有效操作在 AccessibilityNodeInfo
中定义:
ACTION_ACCESSIBILITY_FOCUS
ACTION_CLEAR_ACCESSIBILITY_FOCUS
ACTION_CLEAR_FOCUS
ACTION_CLEAR_SELECTION
ACTION_CLICK
Parameters | |
---|---|
action |
int : The action. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
也可以看看:
void setContentChangeTypes (int changeTypes)
设置由 TYPE_WINDOW_CONTENT_CHANGED
事件发出信号的节点树更改的位掩码。
Parameters | |
---|---|
changeTypes |
int : The bit mask of change types. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
也可以看看:
void setEventTime (long eventTime)
设置此事件发送的时间。
Parameters | |
---|---|
eventTime |
long : The event time. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setEventType (int eventType)
设置事件类型。
Parameters | |
---|---|
eventType |
int : The event type. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setMovementGranularity (int granularity)
设置已遍历的移动粒度。
Parameters | |
---|---|
granularity |
int : The granularity. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
void setPackageName (CharSequence packageName)
设置源的包名称。
Parameters | |
---|---|
packageName |
CharSequence : The package name. |
Throws | |
---|---|
IllegalStateException |
If called from an AccessibilityService. |
String toString ()
返回对象的字符串表示形式。 通常, toString
方法返回一个“文本表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。
类Object
的toString
方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @
”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
String |
a string representation of the object. |
void writeToParcel (Parcel parcel, int flags)
将此对象平铺到一个包裹中。
Parameters | |
---|---|
parcel |
Parcel : The Parcel in which the object should be written. |
flags |
int : Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . |