12

I have designed an Android app, when I test it in a device it's language is Arabic ,the position of image views changes ,like a mirror !

I need a solution to make the layout the same as for English ,because I have image views and I made a translation for them according to screen width,so when the language is Arabic ; the 1% of screen width begins from the right of screen !,and my app when I programmed it ;the image view starts from the left of screen !

I want solution not only for higher SDK !

Some of my java Code :

img = (ImageView) findViewById(R.id.imageView);
img2 = (ImageView) findViewById(R.id.imageView3);


in same function named go has parameters according to img1 and img2:

 dis = metrics.widthPixels * 0.043f;

 fromxall=metrics.widthPixels * 0.01f;
 toxall =  metrics.widthPixels * 0.05f + dis;

fromyall = 0;
 toyall = 0;

TranslateAnimation moveLefttoRight = new TranslateAnimation(fromxall, toxall, fromyall, toyall);
            moveLefttoRight.setDuration(300);
            moveLefttoRight.setFillAfter(true);
            imgx.startAnimation(moveLefttoRight);

2 Answers2

13

In your manifest file put this:

android:supportsRtl="false"
Context
  • 1,873
  • 1
  • 20
  • 24
  • You're welcome, in the default case the **Rtl** it's not supported in the SDK <17 but >17 you have to disable it for not getting the mirror case like what did you find and don't worry about <17 you don't gonna get the problem – Context Dec 23 '15 at 13:51
  • i tried your answer , and it works when the device is Arabic lang. but its mirror in english – Maimoonah Abu Adas Dec 23 '15 at 14:54
4

in manifest change RTL to false

<application
    android:allowBackup="true"
    android:icon="@mipmap/logo"
    android:label="@string/app_name"
    android:supportsRtl="false"
    android:theme="@style/AppTheme">
Osama Ibrahim
  • 995
  • 10
  • 13