为了账号安全,请及时绑定邮箱和手机立即绑定

不推荐使用Android context.getResources

不推荐使用Android context.getResources

慕容708150 2019-09-04 10:05:58
不推荐使用Android context.getResources.updateConfiguration()就在最近的context.getResources()。updateConfiguration()已在Android API 25中弃用,建议使用上下文。而是createConfigurationContext()。有谁知道createConfigurationContext如何用于覆盖android系统区域设置?在此之前将通过以下方式完成:Configuration config = getBaseContext().getResources().getConfiguration();config.setLocale(locale);context.getResources().updateConfiguration(config,                                  context.getResources().getDisplayMetrics());
查看完整描述

3 回答

?
FFIVE

TA贡献1797条经验 获得超6个赞

可能是这样的:

Configuration overrideConfiguration = getBaseContext().getResources().getConfiguration();overrideConfiguration.setLocales(LocaleList);Context context  = createConfigurationContext(overrideConfiguration);Resources resources = context.getResources();




查看完整回答
反对 回复 2019-09-09
  • 3 回答
  • 0 关注
  • 809 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信