I have a complex View, in that i need to set Buttons at the bottom of the page. I need two rows of bottons, with one on the left and two on the right.
The way I manage to solve this is like this:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
...........
</ScrollView>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|bottom"
android:orientation="horizontal">
<TableLayout
android:stretchColumns="1"
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow
android:gravity="center_horizontal"
android:layout_height="wrap_content">
<Button
android:textSize="12sp"
android:id="@+id/btAnterior"
android:layout_width="wrap_content"
android:layout_height="30sp"
android:text="A"
android:background="@drawable/black_buttonSmall"
style="@style/button_text" />
<Button
android:layout_gravity="right"
android:textSize="12sp"
android:id="@+id/btnGuardar"
android:layout_width="wrap_content"
android:layout_height="30sp"
android:text="G"
android:background="@drawable/black_buttonSmall"
style="@style/button_text" />
<Button
android:layout_gravity="right"
android:textSize="12sp"
android:id="@+id/btnCancelar"
android:layout_width="wrap_content"
android:layout_height="30sp"
android:text="C"
android:background="@drawable/black_buttonSmall"
style="@style/button_text" />
</TableRow>
<TableRow
android:gravity="center_horizontal"
android:layout_height="wrap_content">
<Button
android:textSize="12sp"
android:id="@+id/btVolver"
android:layout_width="wrap_content"
android:layout_height="30sp"
android:text="V"
android:background="@drawable/black_buttonSmall"
style="@style/button_text" />
<Button
android:layout_gravity="right"
android:textSize="12sp"
android:id="@+id/btnMateriales"
android:layout_width="wrap_content"
android:layout_height="30sp"
android:text="Materiales"
android:background="@drawable/black_buttonSmall"
style="@style/button_text" />
<Button
android:layout_gravity="right"
android:textSize="12sp"
android:id="@+id/btnUltima"
android:layout_width="wrap_content"
android:layout_height="30sp"
android:text="U"
android:background="@drawable/black_buttonSmall"
style="@style/button_text" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
It look like this
What I need is to set leftMargin on Left and Right.
How can I do it?
Actually why don't you try something like this:
If your parent-root is a RelativeLayout try using
android:layout_alignParentBottom="true"
istead ofandroid:layout_gravity="bottom"