Search code examples
androidxamarin.androidlocaleright-to-left

Is it possible to support rtl text direction according to app's locale while phone is in English?


I managed to support rtl layouts when I have turned my phone's language in aramaic and have set my app's locale accordingly. What I haven't managed to do, and to be honest I wonder if it's possible, is to support rtl layouts when app's locale is set in a language as so (e.g. new Locale("ar")) and my phone's language is in English. When I do so, my app follows an ltr direction and to generalize it I noticed that the text direction of an app is completely depended to phone's language, ignoring locale as for the text direction. So does anybody know how to support rtl logic in an app with a suitable locale but the phone is turned in English? Or if is this even possible?

Edit

Thanks to all the guys that answered the question but their replies don't answer my question. I probably have not made it clear but I managed to support rtl when I have turned my phone in an right-to-left language and forced rtl in developer options. My question is is it possible to have a "right-to-left app" when phone's language is, for example, English but my app's locale is, for example, Aramaic? Or everything will be shown in a "left-to-right" logic but with the respective aramaic translations?


Solution

  • What did the trick for me was to use conf.setLayoutDirection(currentLocale); when updating my resources configuration. So to answer my own question...Yes, it's possible to have an rtl application while the phone's is turned to an ltr language.