Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing the app to work as LTR

Tags:

android

I currently own Galaxy Note 4 with RTL in my language, and whenever I run my app it works from right to left while the app is English.

I need to some kind of "force" the app to be LTR in all kind of devices, RTL and LTR.

How I can force it?

like image 695
TheUnreal Avatar asked Oct 02 '16 13:10

TheUnreal


People also ask

What is RTL in android?

right to left - Android Studio Support rtl - Stack Overflow.

How to RTL in Android Studio?

Just go to Android Studio > Refactor > Add RTL support where possible… I would recommend you checking your app once after applying this change as you might not want all your Layouts/Views to be RTL. If you want to force any layout to LTR then just add android:layoutDirection="ltr" to that view.

At which API version does support for the android right to left RTL API begin?

RTL text mirroring is only supported in apps when used on devices running Android 4.2 (API level 17) or higher.


1 Answers

Add in styles.xml in your Base App theme style:

<item name="android:layoutDirection">ltr</item>

Exemple:

  <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorPrimary</item>
    <item name="android:screenOrientation">portrait</item>
    <item name="android:layoutDirection">ltr</item>
</style>
like image 123
Shlomi Fresko Avatar answered Sep 25 '22 05:09

Shlomi Fresko