In API 21+, you can customize action names by setting custom actions to View AccessibilityNodeInfo . There are two approaches to this: 1) set the AccessibilityDelegate and override the delegate method onInitializeAccessibilityNodeInfo or 2) extend the view class and override the onInitializeAccessibilityNodeInfo .
In any case, you will create a new AccessibilityAction and set it to node using AccessibilityNodeInfo.addAction .
If you decide to use a delegate, you must configure a custom description for the click action as follows:
view.setAccessibilityDelegate(new AccessibilityDelegate() { @Override public void onInitializeAccessibilityNodeInfo( View v, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(v, info);
If you are using API applications <21, replace the corresponding *Compat Support Library methods. This function is not supported in the reverse order, so you wonβt get user-defined descriptions in API <21, but you can avoid explicit version checks in the application code.
source share