在Android Studio中的File菜单中选择Settings,然后在左侧导航中选择Editor选项,接着选择Font,在右侧菜单中选择“Use custom font”选项,选择合适的字体。此外,也可以修改Android Studio的locale设置。在AndroidManifest.xml文件中添加以下语句:
然后在MainActivity.java中添加以下代码:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(updateBaseContextLocale(base));
}
private Context updateBaseContextLocale(Context context) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
// 设置默认为英文
String language = sharedPreferences.getString("language", "en");
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration configuration = context.getResources().getConfiguration();
configuration.setLocale(locale);
return context.createConfigurationContext(configuration);
}
上一篇:AndroidStudioArcticFox中的单元测试不起作用”
下一篇:AndroidStudioArcticFox中,“ColorsforRed-GreenVisionDeficiency”功能无法正常工作?