Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layout changes if device language is Arabic

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);
like image 478
Maimoonah Abu Adas Avatar asked Dec 23 '15 12:12

Maimoonah Abu Adas


People also ask

What is the language used for layout files?

eXtensible Markup Language, or XML: A markup language created as a standard way to encode data in internet-based applications. Android applications use XML to create layout files.


1 Answers

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">
like image 176
Osama Ibrahim Avatar answered Oct 20 '22 02:10

Osama Ibrahim