The title says it all. I found a couple of ways to set the application's default layout to RTL using Facebook's I18nManager, but it does that only on second app launch.
code example: I18nManager.forceRTL(true)
I do not want to give users the ability to change languages because the application itself is in Arabic. I've searched everywhere but all talk about how to support RTL and not actually use it as the default layout.
Is there a way to achieve this with I18nManager or do I have to do a couple of changes to my native code?
To force right-to-left layouts on your Android device you need to open Settings, and access the Developer options menu (if developer options aren't enabled, here's how to do it). Once you've accessed the menu, scroll down to find the “Force RTL layout direction” tab. Tap on it to activate the option, and you're done.
Force RTL layout direction: Forces screen layout direction to be from right to left (RTL) or from left to right (default). Window animation scale: Sets the window animation playback speed so you can check its performance at different speeds. A lower scale results in a faster speed.
add this line of code to the most top of the onCreate method (before super and setContentView) of all of your activities:
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
and sure that you have supportRtl equal to True in manifest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With