I have designed an XML layout as in this image:
I need to equally place the four buttons in the screen but I am having trouble getting it to work. I tried all possible changes that I can think of. Below is the layout's XML:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="@+id/buttonlayout"
android:layout_alignBottom="@id/framelayout">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow>
<Button
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/previous_icon" />
<Button
android:id="@+id/button_startprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/print_icon"
android:padding="10dp" />
<Button
android:id="@+id/button_cam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/cam_icon"
android:padding="10dp" />
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/next_icon"
android:hapticFeedbackEnabled="true"/>
</TableRow>
</TableLayout>
</RelativeLayout>
Can anyone help me out with this?
Hi jxgn use this code :
<?xml version="1.0" encoding="UTF-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/button_startprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/button_cam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher" />
</LinearLayout>
</TableRow>
</TableLayout>