首先,需要在AndroidManifest.xml文件中声明支持的语言,例如:
...
...
然后,在accessibility_service.xml文件中添加语言配置,例如:
This is my sample service.
No enrollment help provided.
This is the enrollment title.
This is the enrollment text.
最后,在适当的地方设置语言,例如:
Resources res = getResources();
Configuration config = new Configuration(res.getConfiguration());
config.setLocale(locale);
res.updateConfiguration(config, res.getDisplayMetrics());
其中,locale指定为支持的语言即可解决问题。