首页 > 解决方案 > 本地化在 android Jellybean 4.2.2 中不起作用

问题描述

本地化在 Jellybeans 4.2.2 中不起作用,我正在使用此代码,并且它在上部设备上运行良好,棒棒糖在更改手机语言时可以正常工作。给出任何解决方案

 Resources resources = context.getResources();
    DisplayMetrics dm = resources.getDisplayMetrics();
    Configuration config = resources.getConfiguration();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        config.setLocale(new Locale(localeCode.toLowerCase()));
    } else {
        config.locale = new Locale(localeCode.toLowerCase());
    }
    resources.updateConfiguration(config, dm);

谁能帮我吗....

标签: androidandroid-studiolocalizationandroid-4.2-jelly-bean

解决方案


推荐阅读