user5708331
user5708331

Reputation: 51

Layout direction changes RTL LTR

It appears that the layout direction of all GUI elements is now controlled by the system language. When it is a right-to-left one, all menus, dialogs, message boxes etc' appear from right to left. This is horrible.

The app has a localizing feature built in("choose your country) How can I make the app localization govern the GUI of the app rather than the devices system language ?

Upvotes: 5

Views: 1978

Answers (1)

Mohammad Zekrallah
Mohammad Zekrallah

Reputation: 449

There is a long journey ahead of you .. you will need to detect device settings in your 'Application' class and then enforce specific locales and layout directions in code .. You will then need to handle onConfigurationChanged for every activity to handle 'layoutdirection|locale' configuration change event and handle those yourself by reloading your activities so that they pick the new runtime changes in order to fetch the correct resources from layout folder on the fly without having to close and reopen the app. To be honest, it's a buggy ride especially the reload activities part which will produce some weird behavior and bugs .. but it's doable eventually ..

Check this out for further info :

https://github.com/aleung/RunningCadence/blob/master/RunningCadence/src/leoliang/runningcadence/Application.java

https://github.com/aleung/RunningCadence/blob/master/RunningCadence/src/leoliang/runningcadence/PreferenceActivity.java

Upvotes: 1

Related Questions