I'm trying to design the layout for tablet. I want each control to have equal spaces between each other. How all of these can be aligned properly ? Sorry I cannot attach the image as I don't have 10 reputation :(. Please help
Here is the layout code and the parent layout is linear layout.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="125dp"
android:background="#517398"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="125dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="30dp"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/image_agenda"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.0"
android:src="@drawable/agenda_view" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="125dp"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<TextView
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_marginRight="40dp"
android:background="#000000" />
<ImageButton
android:id="@+id/image_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:src="@drawable/month_view" />
<TextView
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_marginLeft="40dp"
android:background="#000000" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="125dp"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/image_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1.0"
android:src="@drawable/day_view" />
</LinearLayout>
</RelativeLayout>
// try this way,hope this will help you...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="125dp">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<ImageButton
android:id="@+id/image_agenda"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/ic_launcher" />
</LinearLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<ImageButton
android:id="@+id/image_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/ic_launcher" />
</LinearLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#000000" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center">
<ImageButton
android:id="@+id/image_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/ic_launcher" />
</LinearLayout>
</LinearLayout>
</LinearLayout>