In the attached image I am trying to achieve the alignment of a ui button, I have quite successfully done that but the issue is, its not quite reliable across different screen sizes. I did it with the help of attribute "android:layout_marginRight="60dp"" which is causing issue ("Login" button moves to the right) if I view it on big resolution screen.
And yes I have few more UI View below that login button, (which I have not included in image).
How to generically achieve this layout? UPDATED: XML layout schema
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:layout_marginTop="10dip"
android:text="@string/login"
android:textColor="@color/blue_txt"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:layout_weight="0.0"
android:background="@drawable/rounded_edittext"
android:ems="10"
android:hint="Email or User name"
android:typeface="serif" >
</EditText>
</LinearLayout>
<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:background="@drawable/rounded_edittext"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
android:textStyle="normal"
android:typeface="serif" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="60dp"
android:layout_marginTop="10dip"
android:background="@drawable/loginpage_btn"
android:text="@string/login_btn_text"
android:textColor="@color/white" />
</RelativeLayout>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="35dip"
android:text="@string/login_no_account"
android:textColor="@color/blue_txt"
android:textSize="20sp"
android:textStyle="bold"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dip"
android:src="@drawable/login" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dip"
android:background="@drawable/loginpage_btn"
android:text="@string/login_signup"
android:textColor="@color/white" />
</LinearLayout>