App layout problems with Right-To-Left languages - android

I have developed an app in English language. When i change my android language to a right-to-left (later rtl) language , my app goes rtl layout but I don't want that. I want my app layout to stay left-to-right (later ltr) whether android language is ltr or rtl.
I know there is layoutdirection in a activity attributes but it's not for APIs below 17.

I'd still say to use this:
Add in styles.xml in your Base App theme style:
<item name="android:layoutDirection">ltr</item>
17+ is legitimate.

Just do this in manifest
android:supportsRtl="false"

with support rtl your layout in english is still ltr.
rtl is on only for languages how japanese and so on.
the most devices are already API 17+.
On emulator or device you can change main language, so you can use rtl or rtl layout depend on selected language.

Try to put all of your resources (layouts, strings, drawable ... etc) in rtl language folder like
layout-ar and remove default layout folder
also use values-ar, drawable-ar .... etc only
i think this will force android to read from it.

Related

How to manage RTL languages phones in English application

I am programming an Android application. This application isn't translated to any right to left language (like Arabic or Hebrew). I've noticed that right to left language people has it in English, but with right to left layout. The drawer menu is on the right instead of the left and the text is right aligned.
What is the good practice to manage this? Should I let the RTL layout because they are used to it or should I force LTR layout because the app is in English?
If you’re not supporting RTL languages you should not support RTL layouts (LTR languages looks pretty bad in RTL languages).
Just add android:supportRtl="false" attribute in your manifest's application tag.
It should solve it.
Even though false is the default value, one of your dependencies can override it to true if you don't set it explicitly.
Confirm that this is the issue by checking the final merged manifest if android:supportRtl is true.

Prevent RTL in Android

Is there any way to force left to right layouts when the device language is any rtl language?
All XML Screens got broken when the language is changed to Arabic?
You can forcefully disable rtl by changing its property supportRtl="false" in your AndroidManifest.xml file.

How to display checkbox on the left when change language of Android app to Arabic?

In Settings of my Android app, I use many of checkboxPreferences. When the locale selected is English, text appears at the Left side and Check box at the right side.
Text ------------------Checkbox
When I change locale to Arabic, I want to get this format:
Checkbox---------------Text
But it keeps the same as English locale. I don't know what to do. Can someone help me?
To take advantage of RTL layout mirroring, simply make the following changes to your app:
Declare in your app manifest that your app supports RTL mirroring. Add android:supportsRtl="true" to the element in your manifest file.
Change all of your app's "left/right" layout properties to new "start/end" equivalents.
For more details follow the link
Use RelativeLayout as the parent layout and then add layout_alignParentStart or layout_alignParentEnd attributes for Text / Checkbox views.
Please note, this only works from API v17 on.

RTL Support: Disabling it only for specific UI components

I have a custom video player Activity.
I am forced to enable RTL Support in my Application.
But doing so will result in a Right-To-Left aligned ProgressBar. (And that looks ugly)
I want my ProgressBar to stay LTR in my RTL enabled Application.
Is there any solution?
P.S. I am using Android 4.2.2
Okay there is a simple solution for 4.2 and higher:
You can set the android:layoutDirection property in XML, it can have either rtl or ltr values.
The property overrides android:supportsRtl property in "application" segment of your manifest file.

RTL Languages support in android and resource qualifiers

I read this sentence " Android 2.3 added support for right-to-left (RTL) languages"
and now I want to add RTL support to my app. But I do not know what is qualifiers to add to my layouts.
About res/values/strings.xml , I can named like this res/values-ar/strings.xml
I want to have different layout for RLT languages. I do not want to have just different strings , I also want different layout. What the layout folder name should look like ?
At this moment for the left to right languages it is named
res/lauyots/main.xml
but I do not know how to name it for RTL languages
Is this kind qualifier is present at all ?
You can find -ldrtl and -ldltr qualifiers in Providing resources
res/layout-ldltr/ (Left to Right, default value)
res/layout-ldrtl/ (Right to Left)
#Silwek is right. This is his answer, I am merely putting it here because my answer has been marked as answered.
res/layout-ldltr/ (Left to Right, default value)
res/layout-ldrtl/ (Right to Left)
Old Answer
Check Localization and Multiple Screen Support, they give you idea about resource folders and qualifiers.
You can use locale specific resources and layout like this:
For language specific resources:
res/values/strings.xml
res/values-fr/strings.xml (French)
res/values-ja/strings.xml (Japanese)
For language specific layouts:
res/layout-fr/main.xml
res/layout-ar/main.xml
Using rtl with resources is not a correct approach .. you missed that Devices with RTL locale such Arabic,Hebrew, Persian ... usually enforce all apps ( even with english language only ) to use rtl as language direction and text direction... and here where its dangerous to use rtl in resources because you will cause using your RTL layout for all languages for RTL Locale device. Better to track languages.

Categories

Resources