本文整理汇总了Java中android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.ACTION_SELECT属性的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityNodeInfoCompat.ACTION_SELECT属性的具体用法?Java AccessibilityNodeInfoCompat.ACTION_SELECT怎么用?Java AccessibilityNodeInfoCompat.ACTION_SELECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v4.view.accessibility.AccessibilityNodeInfoCompat
的用法示例。
在下文中一共展示了AccessibilityNodeInfoCompat.ACTION_SELECT属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performAccessibilityAction
@Override
public boolean performAccessibilityAction(View host, int action,
Bundle arguments) {
if (super.performAccessibilityAction(host, action, arguments)) {
return true;
}
final int position = getPositionForView(host);
final ListAdapter adapter = getAdapter();
if ((position == INVALID_POSITION) || (adapter == null)) {
// Cannot perform actions on invalid items.
return false;
}
if (!isEnabled() || !adapter.isEnabled(position)) {
// Cannot perform actions on disabled items.
return false;
}
final long id = getItemIdAtPosition(position);
switch (action) {
case AccessibilityNodeInfoCompat.ACTION_CLEAR_SELECTION: {
if (getSelectedItemPosition() == position) {
setSelection(INVALID_POSITION);
return true;
}
}
return false;
case AccessibilityNodeInfoCompat.ACTION_SELECT: {
if (getSelectedItemPosition() != position) {
setSelection(position);
return true;
}
}
return false;
case AccessibilityNodeInfoCompat.ACTION_CLICK: {
if (isClickable()) {
return performItemClick(host, position, id);
}
}
return false;
case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK: {
if (isLongClickable()) {
return performLongPress(host, position, id);
}
}
return false;
}
return false;
}