问题: Android 80 多语言适配问题
描述:

在对Android 8.0进行适配时遇到某些地方语言为转化
主要是在动态添加二级view的时候语言未转化

此外在语言更新上我已经对版本进行了判断如
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {

   configuration.setLocale(targetLocale);

} else {

        configuration.locale = targetLocale;

}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {

     return mContext.createConfigurationContext(configuration);

}else{

     Resources resources = mContext.getResources();
     DisplayMetrics dm = resources.getDisplayMetrics();
     resources.updateConfiguration(configuration, dm);

}

之后会在相关的Application和BaseActivity中进行配置


解决方案1:

解决了,是因为在相应地方要引用相应的上下文

上一篇Android Studio ndk开发没法自动补全
下一篇Pili-System:unauthorized !
明星图片
相关文章
《 Android 80 多语言适配问题》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)