Android how to position Button to the Right in LinearLayout


Android position button to the Right

Sample LinearLayout XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Sample LinearLayout to push Button to the right"
        android:padding="25sp" />
    <LinearLayout android:layout_height="wrap_content"
        android:layout_width="match_parent" android:id="@+id/linearLayout1"
        android:paddingTop="25dp">
        <TextView android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:text=" " android:id="@+id/textView1"
            android:layout_weight="1" />
        <Button android:layout_width="wrap_content" android:id="@+id/close"
            android:layout_height="wrap_content" android:text="Close" />
    </LinearLayout>
</LinearLayout>

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.