i made this android:supportsRtl="false" for my application
and yet it still flip my layout views when i change the language from English to Arabic and verse versa any clues what to do to prevent the views from flipping not matter what language it runs on or API level
thanks
If targetSdkVersion is set to 16 or lower then it will ignore the RTL support. Otherwise if you change the language then it will support RTL.
As this attribute is supported from the API 17.
Ref Link: https://developer.android.com/guide/topics/manifest/application-element
Related
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.
This is my code:
<EditText
android:layout_width="#dimen/edittext_width"
android:layout_height="#dimen/edittext_height"
android:gravity="right|center_vertical"/>
I want the text go from right, so I add this code: android:gravity="right".
The problem is that the cursor always remain at right.
I Attaching screen shots:
With gravity right -
Without gravity right -
Actually I want it will be like the first image and the last image.
Any help?
Try this .
android:gravity="right"
android:textAlignment="gravity"
Android offers support for right-to-left languages since Android 4.2. See this article on the Android developers blog.
With a few simple changes, your app will be automatically mirrored
when the user switches the system language to a right-to-left script
(such as Arabic, Hebrew, or Persian).
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.
Specifically, 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.
If you are targeting your app to Android 4.2 (the app's targetSdkVersion or minSdkVersion is 17 or higher), then you should use “start” and “end” instead of “left” and “right”. For example, android:paddingLeft should become android:paddingStart.
If you want your app to work with versions earlier than Android 4.2 (the app's targetSdkVersion or minSdkVersion is 16 or less), then you should add “start” and end” in addition to “left” and “right”. For example, you’d use both android:paddingLeft and android:paddingStart.
This could be caused due to the devices or emulators keyboard Locale, If it is set to a language that is not right to left it could override (someone correct me if I'm wrong here).
I have a LinearLayout and on some devices all the views are reversed.
The Good Version:
[b1] [b2] [b3]
On some devices:
[b3] [b2] [b1]
Why does that happen and how can I fix it?
If you're targeting and testing on API level >=17 (i.e. Android 4.2) this might be caused by RTL support, as described here.
If you don't want this, you can either change android:layoutDirection for each particular view (and since the default is inherit, the root view should suffice) or you can disable it for the whole application by setting android:supportsRtl="false" in the AndroidManifest.xml file.
Or, you could also target an API level < 17, since it will then be disabled for compatibility (but this would lock you out of certain APIs).
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.
I really suffer from this issue.
I already set the flag android:configChanges="keyboardHidden|orientation|locale"
But when I changed configuration of language, onconfigurationchanged function isn't called.
The strange thing is that my codes work fine over other android platform.
I searched this issue here.
Someone said that I need to set sdk version lower. But it didn't work.
Please give me some tips.
Add the layoutDirection attribute, such as android:configChanges="keyboardHidden|orientation|locale|layoutDirection" if you're working with API 17.
layoutDirection that is also connected with interface language changes was introduced in API 17. Piece of android docs about android:configChanges is not explicit enough about that fact, but at least we have:
layoutDirection: The layout direction has changed. For example, changing from
left-to-right (LTR) to right-to-left (RTL). Added in API level 17.
From Android 4.2, layout direction will be updated when we change language.
Then we have to add both "locale" and "layoutDirection" as below
android:configChanges="locale|layoutDirection",
that time onConfigurationChanged() will be called.
This is similar with "orientation" and "screenSize" in API 13.
do u config AndroidManifest.xml like this?
android:minSdkVersion="4" android:targetSdkVersion="17"
you need to remove android:targetSdkVersion attribute