android Locale.Builder() doesn't mirror the page in right-to-left locales

懵懂的女人 提交于 2019-12-11 01:00:56

问题


When I use

locale = new Locale("ar"); 

the screen is mirrored in the right way.

In order to give the option to set the numeric system, i have to use the Locale.Builder() inserted with lollipop.

locale = new Locale.Builder().setLanguage("ar").setRegion("MA").setExtension(Locale.UNICODE_LOCALE_EXTENSION, "nu-latn").build();

The problem is that in this way the screen is not mirrored properly. There is a way, like an Extension, to set the rtl attribute?


回答1:


SOLUTION: In order to mirror the screen properly, you have to use the Configuration.

Configuration config = new Configuration();
config.locale = locale;
config.setLayoutDirection(new Locale("ar"));


来源:https://stackoverflow.com/questions/33003948/android-locale-builder-doesnt-mirror-the-page-in-right-to-left-locales

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!