本文整理匯總了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);
}