How to right align widget in horizontal linear layout Android?

This is the code I am using and it is not working:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="horizontal">

    <TextView android:text="TextView" android:id="@+id/textView1"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:gravity="right">
    </TextView>

</LinearLayout>

20 Answers
20

Leave a Comment