Most visited

Recently visited

Added in API level 21

AccessibilityNodeInfo.AccessibilityAction

public static final class AccessibilityNodeInfo.AccessibilityAction
extends Object

java.lang.Object
   ↳ android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction


定义可以在AccessibilityNodeInfo上执行的操作的AccessibilityNodeInfo 每个操作都有一个唯一的ID,它是必需的和可选的数据。

有三类行为:

操作通常通过在 onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)内使用 addAction(AccessibilityAction)添加到 AccessibilityNodeInfo ,并在 onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)performAccessibilityAction(int, Bundle)

注意:支持这些操作的视图应该调用 setImportantForAccessibility(int)IMPORTANT_FOR_ACCESSIBILITY_YES以确保 AccessibilityService可以发现一组支持的操作。

Summary

Fields

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_ACCESSIBILITY_FOCUS

为节点提供可访问性焦点的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_ACCESSIBILITY_FOCUS

清除节点可访问性焦点的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_FOCUS

清除节点输入焦点的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_SELECTION

取消选择节点的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CLICK

点击节点信息的动作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COLLAPSE

动作来折叠可展开的节点。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CONTEXT_CLICK

上下文单击节点的动作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_COPY

动作将当前选择复制到剪贴板。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_CUT

采取措施切断当前选择并将其放入剪贴板。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_DISMISS

采取行动解雇可疑节点。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_EXPAND

操作来展开可展开的节点。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_FOCUS

为节点提供输入焦点的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_LONG_CLICK

长时间点击节点的动作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_AT_MOVEMENT_GRANULARITY

请求以给定移动粒度前往该节点文本中下一个实体的动作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_HTML_ELEMENT

采取措施移动到给定类型的下一个HTML元素。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PASTE

操作来粘贴当前剪贴板内容。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

请求以给定移动粒度前往该节点文本中的前一个实体的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_HTML_ELEMENT

要移动到给定类型的前一个HTML元素的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_BACKWARD

向后滚动节点内容的动作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_DOWN

向下滚动节点内容的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_FORWARD

向前滚动节点内容的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_LEFT

左侧滚动节点内容的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_RIGHT

正确滚动节点内容的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_TO_POSITION

滚动节点以使指定的收集位置在屏幕上可见的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_UP

向上滚动节点内容的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SELECT

选择节点的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_PROGRESS

采取 RangeInfo.getMin()RangeInfo.getMax()之间的行动。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_SELECTION

设置选择的动作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SET_TEXT

设置节点文本的操作。

public static final AccessibilityNodeInfo.AccessibilityAction ACTION_SHOW_ON_SCREEN

请求节点使其边界矩形在屏幕上可见的动作,如有必要,滚动即可。

Public constructors

AccessibilityNodeInfo.AccessibilityAction(int actionId, CharSequence label)

创建一个新的AccessibilityAction。

Public methods

boolean equals(Object other)

指示其他某个对象是否“等于”这一个。

int getId()

获取此操作的标识。

CharSequence getLabel()

获取此操作的标签。

int hashCode()

返回对象的哈希码值。

String toString()

返回对象的字符串表示形式。

Inherited methods

From class java.lang.Object

Fields

ACTION_ACCESSIBILITY_FOCUS

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_ACCESSIBILITY_FOCUS

为节点提供可访问性焦点的操作。

ACTION_CLEAR_ACCESSIBILITY_FOCUS

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_ACCESSIBILITY_FOCUS

清除节点可访问性焦点的操作。

ACTION_CLEAR_FOCUS

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_FOCUS

清除节点输入焦点的操作。

ACTION_CLEAR_SELECTION

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_SELECTION

取消选择节点的操作。

ACTION_CLICK

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_CLICK

点击节点信息的动作。

ACTION_COLLAPSE

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_COLLAPSE

动作来折叠可展开的节点。

ACTION_CONTEXT_CLICK

Added in API level 23
AccessibilityNodeInfo.AccessibilityAction ACTION_CONTEXT_CLICK

上下文单击节点的动作。

ACTION_COPY

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_COPY

动作将当前选择复制到剪贴板。

ACTION_CUT

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_CUT

采取措施切断当前选择并将其放入剪贴板。

ACTION_DISMISS

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_DISMISS

采取行动解雇可疑节点。

ACTION_EXPAND

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_EXPAND

操作来展开可展开的节点。

ACTION_FOCUS

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_FOCUS

为节点提供输入焦点的操作。

ACTION_LONG_CLICK

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_LONG_CLICK

长时间点击节点的动作。

ACTION_NEXT_AT_MOVEMENT_GRANULARITY

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_AT_MOVEMENT_GRANULARITY

请求以给定移动粒度前往该节点文本中下一个实体的动作。 例如,移至下一个字符,单词等。

参数: AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INTAccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
示例:移至上一个字符并且不扩展选择。

Bundle arguments = new Bundle(); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER); arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, false); info.performAction(AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY.getId(), arguments);

也可以看看:

ACTION_NEXT_HTML_ELEMENT

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_HTML_ELEMENT

采取措施移动到给定类型的下一个HTML元素。 例如,移至按钮,输入,表格等

参数: AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING
例如:

Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityAction.ACTION_NEXT_HTML_ELEMENT.getId(), arguments);

ACTION_PASTE

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_PASTE

操作来粘贴当前剪贴板内容。

ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY

请求以给定移动粒度前往该节点文本中的前一个实体的操作。 例如,移至下一个字符,单词等。

参数: AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INTAccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN
示例:移至下一个字符并且不扩展选择。

Bundle arguments = new Bundle(); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER); arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, false); info.performAction(AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY.getId(), arguments);

也可以看看:

ACTION_PREVIOUS_HTML_ELEMENT

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_HTML_ELEMENT

要移动到给定类型的前一个HTML元素的操作。 例如,移至按钮,输入,表格等

参数: AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING
例如:

Bundle arguments = new Bundle(); arguments.putString(AccessibilityNodeInfo.ACTION_ARGUMENT_HTML_ELEMENT_STRING, "BUTTON"); info.performAction(AccessibilityAction.ACTION_PREVIOUS_HTML_ELEMENT.getId(), arguments);

ACTION_SCROLL_BACKWARD

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_BACKWARD

向后滚动节点内容的动作。

ACTION_SCROLL_DOWN

Added in API level 23
AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_DOWN

向下滚动节点内容的操作。

ACTION_SCROLL_FORWARD

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_FORWARD

向前滚动节点内容的操作。

ACTION_SCROLL_LEFT

Added in API level 23
AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_LEFT

左侧滚动节点内容的操作。

ACTION_SCROLL_RIGHT

Added in API level 23
AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_RIGHT

正确滚动节点内容的操作。

ACTION_SCROLL_TO_POSITION

Added in API level 23
AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_TO_POSITION

滚动节点以使指定的收集位置在屏幕上可见的操作。

参数:

ACTION_SCROLL_UP

Added in API level 23
AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_UP

向上滚动节点内容的操作。

ACTION_SELECT

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_SELECT

选择节点的操作。

ACTION_SET_PROGRESS

Added in API level 24
AccessibilityNodeInfo.AccessibilityAction ACTION_SET_PROGRESS

采取RangeInfo.getMin()RangeInfo.getMax()之间的进展的行动。 它应该使用与RangeInfo.getType()相同的值类型

参数: ACTION_ARGUMENT_PROGRESS_VALUE

也可以看看:

ACTION_SET_SELECTION

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_SET_SELECTION

设置选择的动作。 不使用参数执行此操作将清除选择。

参数: AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INTAccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT
例如:

Bundle arguments = new Bundle(); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 1); arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 2); info.performAction(AccessibilityAction.ACTION_SET_SELECTION.getId(), arguments);

也可以看看:

ACTION_SET_TEXT

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction ACTION_SET_TEXT

设置节点文本的操作。 使用null或清空CharSequence执行无参数操作将清除文本。 这个动作也会把光标放在文本的末尾。

参数: AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
例如:

Bundle arguments = new Bundle(); arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, "android"); info.performAction(AccessibilityAction.ACTION_SET_TEXT.getId(), arguments);

ACTION_SHOW_ON_SCREEN

Added in API level 23
AccessibilityNodeInfo.AccessibilityAction ACTION_SHOW_ON_SCREEN

请求节点使其边界矩形在屏幕上可见的动作,如有必要,滚动即可。

也可以看看:

Public constructors

AccessibilityNodeInfo.AccessibilityAction

Added in API level 21
AccessibilityNodeInfo.AccessibilityAction (int actionId, 
                CharSequence label)

创建一个新的AccessibilityAction。 要添加没有特定标签的标准操作,请使用静态常量。 您也可以覆盖标准操作的说明。 以下是如何通过添加自定义标签来覆盖标准点击操作的示例:

   AccessibilityAction action = new AccessibilityAction(
           AccessibilityAction.ACTION_ACTION_CLICK, getLocalizedLabel());
   node.addAction(action);
 

Parameters
actionId int: The id for this action. This should either be one of the standard actions or a specific action for your app. In that case it is required to use a resource identifier.
label CharSequence: The label for the new AccessibilityAction.

Public methods

equals

Added in API level 21
boolean equals (Object other)

指示其他某个对象是否“等于”这一个。

equals方法在非空对象引用上实现等价关系:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

equals类的方法Object实现对象上最可能的等价关系; 也就是说,对于任何非空参考值xy ,当且仅当xy引用同一对象( x == y的值为true )时,此方法返回true

请注意,无论何时重写此方法,通常都需要重写 hashCode方法,以便维护 hashCode方法的一般合同,该方法声明相等对象必须具有相同的哈希代码。

Parameters
other Object: the reference object with which to compare.
Returns
boolean true if this object is the same as the obj argument; false otherwise.

getId

Added in API level 21
int getId ()

获取此操作的标识。

Returns
int The action id.

getLabel

Added in API level 21
CharSequence getLabel ()

获取此操作的标签。 其目的是向用户描述操作。

Returns
CharSequence The label.

hashCode

Added in API level 21
int hashCode ()

返回对象的哈希码值。 为了散列表的好处而支持该方法,例如由HashMap提供的HashMap

一般合约 hashCode是:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

尽可能合理实用,类Object定义的hashCode方法确实为不同的对象返回不同的整数。 (这通常通过将对象的内部地址转换为整数来实现,但Java TM编程语言不需要此实现技术。)

Returns
int a hash code value for this object.

toString

Added in API level 21
String toString ()

返回对象的字符串表示形式。 通常, toString方法会返回一个“文本地表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。

ObjecttoString方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

Hooray!