android Locale.Builder() doesn't mirror the pa

2019-07-13 12:35发布

问题:

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"));