我的理解是 UIAutomator 无法自动化 uiautomatorviewer 中 NAF = true 的任何元素。我已经搜索了高低,但我一生都无法找到 NAF 代表什么。有人知道吗?
最佳答案
" 无障碍友好 "
这些 UI 元素显然是交互式的,但没有像内容描述这样的可访问性可供性。
来自 AccessibilityNodeInfoDumper.java 的来源(uiautomator 的一部分):
/** * We're looking for UI controls that are enabled, clickable but have no * text nor content-description. Such controls configuration indicate an * interactive control is present in the UI and is most likely not * accessibility friendly. We refer to such controls here as NAF controls * (Not Accessibility Friendly) * * @param node * @return false if a node fails the check, true if all is OK */ private static boolean nafCheck(AccessibilityNodeInfo node) { boolean isNaf = node.isClickable() && node.isEnabled() && safeCharSeqToString(node.getContentDescription()).isEmpty() && safeCharSeqToString(node.getText()).isEmpty(); if (!isNaf) return true; // check children since sometimes the containing element is clickable // and NAF but a child's text or description is available. Will assume // such layout as fine. return childNafCheck(node); }
关于android-uiautomator - uiautomatorviewer - NAF 代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25435878/