android权限字符串,android - 有没有办法在android中本地化marshmallow权限字符串? - SO中文参考 - www.soinside.com...

我正在尝试本地化许可消息,例如允许应用程序访问相机拍摄照片或视频等

应用程序的其余部分已本地化。

这是我到目前为止所尝试的:

@Override

protected void attachBaseContext(Context base) {

super.attachBaseContext(App.localeManager.setLocale(base));

Log.d(TAG, "attachBaseContext");

}

public Context setLocale(Context c) {

return updateResources(c, getLanguage());

}

private Context updateResources(Context context, String language) {

Locale locale = new Locale(language);

Locale.setDefault(locale);

Resources res = context.getResources();

Configuration config = new Configuration(res.getConfiguration());

if (Utility.isAtLeastVersion(JELLY_BEAN_MR1)) {

config.setLocale(locale);

context = context.createConfigurationContext(config);

} else {

config.locale = locale;

res.updateConfiguration(config, res.getDisplayMetrics());

}

return context;

}

如果在设置中更改语言,则权限消息将被本地化。

任何帮助将不胜感激,谢谢。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值