本文整理匯總了Java中android.view.accessibility.AccessibilityNodeInfo.isVisibleToUser方法的典型用法代碼示例。如果您正苦於以下問題:Java AccessibilityNodeInfo.isVisibleToUser方法的具體用法?Java AccessibilityNodeInfo.isVisibleToUser怎麽用?Java AccessibilityNodeInfo.isVisibleToUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.accessibility.AccessibilityNodeInfo
的用法示例。
在下文中一共展示了AccessibilityNodeInfo.isVisibleToUser方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildChildren
import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
private List<UiAutomationElement> buildChildren(AccessibilityNodeInfo node) {
List<UiAutomationElement> children;
int childCount = node.getChildCount();
if (childCount == 0) {
children = null;
} else {
children = new ArrayList<UiAutomationElement>(childCount);
for (int i = 0; i < childCount; i++) {
AccessibilityNodeInfo child = node.getChild(i);
if (child != null && child.isVisibleToUser()) {
children.add(this.getElement(child, this, i));
}
}
}
return children;
}
示例2: isVisibleToUser
import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/***
* Check the node whether it is visible.
* @param accessibilityNodeInfo
* @return
*/
public static boolean isVisibleToUser(AccessibilityNodeInfo accessibilityNodeInfo) {
if (accessibilityNodeInfo == null) {
return false;
}
return accessibilityNodeInfo.isEnabled() && accessibilityNodeInfo.isVisibleToUser();
}
示例3: UiAutomationElement
import android.view.accessibility.AccessibilityNodeInfo; //導入方法依賴的package包/類
/**
* A snapshot of all attributes is taken at construction. The attributes of a
* {@code UiAutomationElement} instance are immutable. If the underlying
* {@link AccessibilityNodeInfo} is updated, a new {@code UiAutomationElement}
* instance will be created in
*/
protected UiAutomationElement( AccessibilityNodeInfo node,
UiAutomationElement parent, int index) {
this.node = node;
this.parent = parent;
Map<Attribute, Object> attribs = new EnumMap<Attribute, Object>(Attribute.class);
put(attribs, Attribute.INDEX, index);
put(attribs, Attribute.PACKAGE, charSequenceToString(node.getPackageName()));
put(attribs, Attribute.CLASS, charSequenceToString(node.getClassName()));
put(attribs, Attribute.TEXT, charSequenceToString(node.getText()));
put(attribs, Attribute.CONTENT_DESC, charSequenceToString(node.getContentDescription()));
put(attribs, Attribute.RESOURCE_ID, charSequenceToString(node.getViewIdResourceName()));
put(attribs, Attribute.CHECKABLE, node.isCheckable());
put(attribs, Attribute.CHECKED, node.isChecked());
put(attribs, Attribute.CLICKABLE, node.isClickable());
put(attribs, Attribute.ENABLED, node.isEnabled());
put(attribs, Attribute.FOCUSABLE, node.isFocusable());
put(attribs, Attribute.FOCUSED, node.isFocused());
put(attribs, Attribute.LONG_CLICKABLE, node.isLongClickable());
put(attribs, Attribute.PASSWORD, node.isPassword());
put(attribs, Attribute.SCROLLABLE, node.isScrollable());
if (node.getTextSelectionStart() >= 0
&& node.getTextSelectionStart() != node.getTextSelectionEnd()) {
attribs.put(Attribute.SELECTION_START, node.getTextSelectionStart());
attribs.put(Attribute.SELECTION_END, node.getTextSelectionEnd());
}
put(attribs, Attribute.SELECTED, node.isSelected());
put(attribs, Attribute.BOUNDS, getBounds(node));
attributes = Collections.unmodifiableMap(attribs);
// Order matters as getVisibleBounds depends on visible
visible = node.isVisibleToUser();
visibleBounds = getVisibleBounds(node);
List<UiAutomationElement> mutableChildren = buildChildren(node);
this.children = mutableChildren == null ? null : Collections.unmodifiableList(mutableChildren);
}