Search code examples
androidright-to-left

Don't change the design when language of phone changed


hello i'm a new android developer and I create an android app. when the language of phone is English everything is good but when i change it to a right to left language (for example Persian or Arabic) location of views are changed. what should i do? thanks .


Solution

  • in your AndroidManifest.xml, add the following line to the application node's attributes:

    android:supportsRtl="false"
    

    Your final code should look like this

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.app">
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="false"
            android:theme="@style/AppTheme">
    
        ...
    
        </application>
    
    </manifest>