下面列出了android.view.accessibility.AccessibilityNodeInfo#isSelected ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Checks if the UI element's <code>selected</code> property is currently true.
*
* @return true if it is else false
* @throws UiObjectNotFoundException
* @since API Level 16
*/
public boolean isSelected() throws UiObjectNotFoundException {
Tracer.trace();
AccessibilityNodeInfo node = findAccessibilityNodeInfo(mConfig.getWaitForSelectorTimeout());
if(node == null) {
throw new UiObjectNotFoundException(mUiSelector.toString());
}
return node.isSelected();
}
/**
* Checks if the UI element's <code>selected</code> property is currently true.
*
* @return true if it is else false
* @throws UiObjectNotFoundException
* @since API Level 16
*/
public boolean isSelected() throws UiObjectNotFoundException {
Tracer.trace();
AccessibilityNodeInfo node = findAccessibilityNodeInfo(mConfig.getWaitForSelectorTimeout());
if(node == null) {
throw new UiObjectNotFoundException(mUiSelector.toString());
}
return node.isSelected();
}
public static void dumpNode(AccessibilityNodeInfo info, Node root,
int index, int width, int height) {
root.sourceId = info.getSourceNodeId();
root.index = index;
root.text = safeCharSeqToString(info.getText());
root.res = safeCharSeqToString(info.getViewIdResourceName());
root.clazz = safeCharSeqToString(info.getClassName());
root.pkg = safeCharSeqToString(info.getPackageName());
root.desc = safeCharSeqToString(info.getContentDescription());
root.checkable = info.isCheckable();
root.checked = info.isChecked();
root.clickable = info.isClickable();
root.enabled = info.isEnabled();
root.focusable = info.isFocusable();
root.focused = info.isFocused();
root.scrollable = info.isScrollable();
root.longClickable = info.isLongClickable();
root.password = info.isPassword();
root.selected = info.isSelected();
android.graphics.Rect r = AccessibilityNodeInfoHelper
.getVisibleBoundsInScreen(info, width, height);
root.rect = new Rect(r.left, r.top, r.right, r.bottom);
root.children = new ArrayList<Node>();
int count = info.getChildCount();
for (int i = 0; i < count; i++) {
AccessibilityNodeInfo child = info.getChild(i);
if (child != null) {
if (child.isVisibleToUser()) {
Node childNode = new Node();
dumpNode(child, childNode, i, width, height);
root.children.add(childNode);
child.recycle();
}
}
}
}