i have a linear layout , which contains a textView and EditText arranged horizontally.i have an option for selecting language in prvious activity (english and arabic). when i select english the current alignment is fine but when i select Arabic it should show right to left that means the textView position should go to right (in layout it will start from left) after that the editText.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/darkblue_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/editusername"
android:layout_width="196dp"
android:layout_height="wrap_content"
android:background="@drawable/textfield_default"
android:ems="10" >
</EditText>
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
anybody pls give me solution...
You can specify a layout that is specific to a language, by placing that layout inside an appropriate layout folder. I don't know what the code is for Arabic, but it should be something like /layout-aa/
Far better today, however, is to use a relative layout, where you use the android:gravity="start"
or similar, aligning it based on the language orientation and not strictly left/right. This is available with API version 14 and above.