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.
Related
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.
When operating on a LTR language phone my app looks fine like this:
but when operating on a RTL language phone my app gets either glued to the right like this:
or you can't even see the screen like this:
how can i make my app look exactly as it looks on a LTR phone?
p.s i have already tried the refactor adjust to RTL language and it didnt change anything.
thanks
It sounds like you want to essentially disable RTL support in your app. To do this, go to your AndroidManifest.xml and add this attribute to the <application> tag:
<application
android:supportsRtl="false"
...>
Note that this attribute exists by default, but is set to true (so you just need to change the value to false).
In your Xml while specifying margins for your views always use the attribute marginStart and marginEnd instead of marginLeft and marginRight.For more info on this refer this answer here.
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.
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.
I've set my application to support RTL by adding the "supportRTL = true" to the Android Manifest. Now I Want to create an activity with a LTR orientation, meaning the Toolbar should appear LTR and not RTL. Problem is, whatever I do, I can't get the toolbar to switch back to LTR. How should I do it?
you can use
android:layoutDirection="ltr"
only used in API level 17 and higher