Sergiy
Sergiy

Reputation: 221

Make the default locale LTR (Android)

Let's say I have the default strings in res/values/strings.xml. They are in English. The android:supportsRtl="true" in the AndroidManifest.xml.

A user with the system language Hebrew opens my app, and they see all English strings drawn right-to-left.

Is there any way to specify that the default locale is LTR? I've tried to set tools:locale="en", but that didn't help.

I don't think it's a good idea to disable the "supportsRtl". For example, if I have the Arabic translation, I want it to be displayed RTL. But for Hebrew users it should be the default English version LTR.

Please help.

Upvotes: 0

Views: 167

Answers (1)

Pratik18
Pratik18

Reputation: 375

set this code before layout load.

Configuration config = new Configuration();
config.locale = new Locale("set default local language");
getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());

Upvotes: 0

Related Questions