更改设置首选项标题的对讲通知

时间:2018-08-17 20:03:57

标签: java android talkback

是否可以更改对讲菜单设置标题的内容?目前,对讲说“设置”。我想说“设置菜单”。内容描述当然行不通。因此,我尝试使用辅助功能方法。这是我想出的:

public class SettingsFragment extends BaseSettingsFragment implements SharedPreferences.OnSharedPreferenceChangeListener {

private boolean localeUpdated;
private Context mContext;

public static SettingsFragment newInstance() {
    return new SettingsFragment();
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);
    changeTalkbackSettingAnnouncement();
}

private void changeTalkbackSettingAnnouncement() {
    if(mContext != null) {
        AccessibilityManager am = (AccessibilityManager) mContext.getSystemService(ACCESSIBILITY_SERVICE);
        if (am.isEnabled() && am.isTouchExplorationEnabled()) {
            //Change announcement
            AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
            event.setContentDescription("@string/talk_back_settings");
        }
    }
}

任何帮助将不胜感激!

0 个答案:

没有答案