为您的 editText 或 textView 使用以下 Accessibility Deligate
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
switch (host.getId()) {
case R.id.tv_bookingID:
if (((TextView) host).getText().length() > 1) {
sb.delete(0, sb.length());
for (char c : ((TextView) host).getText().toString().toCharArray()) {
sb.append(c).append(" ");
}
//change text for talkback
info.setText(null);
info.setContentDescription(sb.toString().trim());
}
break;
}//switch
}//if
}