更改android语言时,更改了android持续时间,但仍然仅在启动时显示

时间:2019-07-12 03:01:01

标签: android android-studio

GitHub中的android

https://github.com/abora97/Hti_graduation_project

当更改android语言时,更改了android持续时间,但仍然仅在启动时显示语言

SharedPreferences sharedPreferences = getSharedPreferences(Constanes.EVDP, MODE_PRIVATE);
    String o = sharedPreferences.getString(Constanes.LANGUAGE, getResources().getConfiguration().locale.getISO3Language());
    getResources().getConfiguration().locale = (new Locale(o));
    if (o.equalsIgnoreCase("ar"))
        getResources().getConfiguration().screenLayout = Configuration.SCREENLAYOUT_LAYOUTDIR_RTL;
    else
        getResources().getConfiguration().screenLayout = Configuration.SCREENLAYOUT_LAYOUTDIR_LTR;


    DefaultLang = o.toString();
    Configuration config = getResources().getConfiguration();
    getResources().updateConfiguration(
            config,
            getResources().getDisplayMetrics()
    );
    getApplicationContext().getResources().updateConfiguration(
            config,
            getResources().getDisplayMetrics()
    );}

0 个答案:

没有答案