不推荐使用Android context.getResources

不推荐使用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());


慕容708150
浏览 812回答 3
3回答

FFIVE

可能是这样的:Configuration overrideConfiguration = getBaseContext().getResources().getConfiguration();overrideConfiguration.setLocales(LocaleList);Context context  = createConfigurationContext(overrideConfiguration);Resources resources = context.getResources();
打开App,查看更多内容
随时随地看视频慕课网APP