本文整理汇总了Java中android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityNodeInfo.AccessibilityAction方法的具体用法?Java AccessibilityNodeInfo.AccessibilityAction怎么用?Java AccessibilityNodeInfo.AccessibilityAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityNodeInfo
的用法示例。
在下文中一共展示了AccessibilityNodeInfo.AccessibilityAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withUsageHintOnClick
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static Matcher<? super View> withUsageHintOnClick(final Matcher<? extends CharSequence> charSequenceMatcher) {
return new TypeSafeMatcher<View>() {
@Override
protected boolean matchesSafely(View view) {
if (!view.isClickable()) {
return false;
}
AccessibilityNodeInfo.AccessibilityAction clickAction = findAction(view, AccessibilityNodeInfo.ACTION_CLICK);
return charSequenceMatcher.matches(clickAction.getLabel());
}
@Override
public void describeTo(Description description) {
description.appendText("is clickable and has custom usage hint for ACTION_CLICK: ");
charSequenceMatcher.describeTo(description);
}
};
}
示例2: withUsageHintOnLongClick
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static Matcher<? super View> withUsageHintOnLongClick(final Matcher<? extends CharSequence> charSequenceMatcher) {
return new TypeSafeMatcher<View>() {
@Override
protected boolean matchesSafely(View view) {
if (!view.isLongClickable()) {
return false;
}
AccessibilityNodeInfo.AccessibilityAction clickAction = findAction(view, AccessibilityNodeInfo.ACTION_LONG_CLICK);
return charSequenceMatcher.matches(clickAction.getLabel());
}
@Override
public void describeTo(Description description) {
description.appendText("is long clickable and has custom usage hint for ACTION_LONG_CLICK: ");
charSequenceMatcher.describeTo(description);
}
};
}
示例3: findAction
import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
public static AccessibilityNodeInfo.AccessibilityAction findAction(View view, int actionId) {
AccessibilityNodeInfo accessibilityNodeInfo = view.createAccessibilityNodeInfo();
for (AccessibilityNodeInfo.AccessibilityAction accessibilityAction : accessibilityNodeInfo.getActionList()) {
if (actionId == accessibilityAction.getId()) {
return accessibilityAction;
}
}
throw new AccessibilityActionNotFoundException(actionId);
}