I’ve searched how can I align the app to the right side and the text to be written from right to left.
The only thing I’ve found and succeeded to do is to make the text be written from right to left by adding android:gravity="right"
in the EditText and the Button, but still their sort in the line if from the left to the right.
The activity_main.xml file –
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:gravity="right"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<EditText android:id="@+id/text_message"
android:gravity="right"
android:layout_weight="1.0"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/text_message" />
<Button android:layout_height="wrap_content"
android:gravity="right"
android:layout_width="wrap_content"
android:text="@string/send_button"
android:onClick="ButtonClicked" />
<Button android:layout_height="wrap_content"
android:gravity="right"
android:layout_width="wrap_content"
android:text="@string/delete_button"
android:onClick="DeleteClicked" />
</LinearLayout>
What I meant in “the sort is from the left to the right” is that the EditText is written before the “Send” button, and the “Send” button id written before the “Delete” button – so what’s shown is
“[____x] [Send][Delete]” and not “[Delete][Send][_____]”, as I would want to.
You can use instead of
LinearLayout,RelativeLayoutand give your buttons some ids usingand then use the tags
android:layout_toRightOfandandroid:layout_toLeftOf. In your case, something like this: