I am trying to learn the android
platform and everything was perfectly fine. I made a mistake and never switched to other phone to check my layout. So, I did it today and the result was disappointed. I am using RelativeLayout
but mostly with height
and fill_parent
in width
.
Here is my one of the layout
file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffd5d6d6">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="47dip"
android:background="#ffffffff">
<ImageView
android:id="@+id/flag"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/ic_back"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp" />
<TextView
android:id="@+id/profileDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Roommate"
android:textColor="#ff3c3f41"
android:textSize="19dp"
android:layout_centerInParent="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="52dp">
<TextView
android:id="@+id/roommate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Who do you want your..."
android:textColor="#ff3c3f41"
android:textSize="20dp"
android:layout_alignParentStart="false"
android:layout_marginLeft="72dp"
android:layout_marginRight="72dp"
android:layout_marginTop="38dp" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="84dp"
android:layout_alignBottom="@+id/relativeLayout10">
<TextView
android:id="@+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Gender"
android:textColor="#ff3c3f41"
android:textSize="19dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="38dp" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="89dp"
android:layout_marginTop="81dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="#ffffffff">
</RelativeLayout>
<TextView
android:id="@+id/age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age"
android:textColor="#ff3c3f41"
android:textSize="19dp"
android:layout_marginTop="215dp"
android:layout_centerHorizontal="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="258dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:background="#ffffffff"
android:id="@+id/relativeLayout6">
</RelativeLayout>
</RelativeLayout>
<Button
android:id="@+id/button"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="47dp"
android:background="#fa6425"
android:text="Next"
android:textColor="#fff4f4f4"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Above layout is showing different alignment
in different different phone screen. What would be the best way to fix this thing? Any help or guidance will be appreciable.