I'm new to android and i want to translate an app. to arabic and force RTL direction.
If anyone can help please.
Thank you
If you want to support Arabic for your app, follow the below steps :
1) Create resource file (res/values-ar/strings.xml) and put your content.
2) Mostly supportsRTl set as true. Check once in Manifest file.
Example:Creating Arabic resource file
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
3) Test it in your device by doing below settings changes :
Select locale(Arabic) in language option
"Force RTL layout direction" in Developer option.
Note : Developer option will be enabled once you select build number 7 times. (inside Settings/ About Phone)
You can find simple example in below link:
https://www.tutorialspoint.com/android/android_localization.htm
Related
I have a normal Textview which contains both Arabic and English texts.
Below is the original text
"unit_label_text": "محتوى 0.4kg (€ 10.00 / 1Kg)",
When I try to paste it inside of xml it's like the below and the mobile app itself showing the same.
Note: When the device language is English it's working fine. But if I changed the device language to Arabic. It's not working,
When you use the Arabic language the app automatically uses the RTL format so you can consider disabling the RTL (Right to Left) format for your app.
In your manifest file and inside the application tag add these two lines.
<manifest>
<application
.
.
.
android:supportsRtl="false"
tools:replace="android:supportsRtl"
>
</application>
Or else try removing this code from your XML
android:layoutDirection="rtl"
I just published my app on play store and I notice that some Samsung device does not display the icon of my app. They assert the default icon of android studio. Have you an idea what can cause that? i'm confused
<application
android:name=".MyApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:label="#string/app_name"
android:theme="#style/AppTheme">
....
</application>
Try This;
File -> New -> Image Asset -> Launcher Icons (Adaptive and Legacy)
For more information;
https://proandroiddev.com/android-adaptive-icons-are-easier-than-you-think-3c66be2dd4dd
https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
Remove this line..
android:roundIcon="#mipmap/ic_launcher_round"
My issue was solved by restarting the phone.
I thing some device had oreo and pie OS that why device does not show the correct app icon.Now you can delete ic_launcher_round and ic_launcher from mipmap-anydpi-v26
please check this link Launcher Icon is not Shown in Oreo 8.0/8.1
This happened to me when I noticed my mipmap folder is missing but if I search the icons in the project they are there. So I created a mipmap folder manually New > Android resource directory > Mipmap. Then I generated the image asset for the icons again.
I've disabled and forced my application to not support rtl . Because it made lots of problems of views and layouts , this is my manifest code:
<application
android:name="ir.dizbon.persiandesigners.ParseApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="false"
android:theme="#style/AppTheme"
tools:replace="android:supportsRtl">
in one layout I add this code :
android:layoutDirection="rtl"
When I remove the manifest code ,the layout change the direction and works fine but I can't remove manifest codes .
I tried to change the direction pragmatically:
pass_l.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
it doesn't work either .
How can I make my view to support rtl and get rtl ?
You can create different layout in android studio to support rtl.
Right click layout -> New -> Layout Resource File -> then choose Layout Direction Qualifier.
I have two languages in my app, English and Urdu. When the language is changed to Urdu home up button changes its direction like this:
Please help me how can I fix this issue. I want arrow direction to be on left side
To support right to left screen layout, you have to android:supportsRtl="true" line in your manifest.xml For example:
<application
android:name=".Application"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
>
After writing this tag, the arrow button will appear on the right and other icons on the left.
For more information, see this post.
There is not issue and supportsRtl.
Because if
android:supportsRtl="true"
then view display from right-hand-side.
If false then it'll display as it is.
Can i have your manifest application tag and style which used there?
I have an app that supports Hebrew and declares in the manifest its support for RTL locales. However, there are other RTL locales that I do not support and would like my Views not to be mirrored when these locales are set. For example, I don't want my app's Views to be swapped from right to left when in the Arabic locale, since I don't support Arabic and therefore text will show in English.
I guess the best way is to make android:supportsRtl value to be selected according to the language. To do that see below:
AndroidManifest.xml
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:supportsRtl="#string/is_hebrew" >...</application>
Then in values/strings.xml add:
<string name="is_hebrew">false</string>
And with values-he/strings.xml add:
<string name="is_hebrew">true</string>
You can choose to turn mirroring on or off at runtime. See https://stackoverflow.com/a/17683045/192373. This is limited to 4.2 or higher, and only in onCreate() of your activity.