0
votes

how prevent the android application layout from change it's direction when change the language of mobile.

without using layoutDirection ltr or rtl .

3
Why not use layoutDirection? It's designed exactly for when you want to control layout direction. - Ted Hopp

3 Answers

0
votes

In the manifest file, in the Application tag you can specify if the RTL is supported or not

<application
  android:supportsRtl="false">

you can find more information here https://developer.android.com/guide/topics/manifest/application-element.html

0
votes

In your application definition in your manifest, you can add:

android:supportsRtl="false"

*Note that this is only supported in API 17 and is false by default.

0
votes

call this method on onResume method :

    public void SetLocale(Context context) {

       Locale.setDefault(new Locale("en"));
       Configuration conf = context.getResources().getConfiguration();
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
          conf.setLayoutDirection(new Locale("en"));
       }
       context.getResources().updateConfiguration(conf,
                              context.getResources().getDisplayMetrics());

     }