Force RTL on LTR devices

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.


MageNative's answer is correct. The only thing is setting the locale like that is deprecated. You need to use the setLocale() method, like this:

Locale locale = new Locale("fa_IR"); // This is for Persian (Iran)
Locale.setDefault(locale);
Configuration config = new Configuration();
config.setLocale(locale);
getApplicationContext().getResources().updateConfiguration(config, getApplicationContext().getResources().getDisplayMetrics());

You'll need to import java.util.Locale and android.content.res.Configuration.


First, add RTL support in the manifest like this:

<application
    android:name=".application.SampleApplication"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
</application>

Then, on your launcher activity add the following code in onCreate().

Locale locale = new Locale("ar");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale; 
getApplicationContext().getResources().updateConfiguration(config, getApplicationContext().getResources().getDisplayMetrics());