score:1

Accepted answer

you can use match_parent in the table layout so it takes the full width of the parent then adjust left and right padding to generate the desired separation. bear in mind that you already have a padding defined in your relative layout hence you you will need to play with both values.

<tablelayout
    android:id="@+id/tablelayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingleft="10dp"
    android:paddingright="10dp"
    android:layout_alignparentbottom="true"
    android:layout_centerhorizontal="true" >

score:0

you set android:layout_width="wrap_content" to the tablelayout which causes it to be just wide enough to show all the content. try using match_parent to make it take the entire parent width:

<tablelayout
    android:id="@+id/tablelayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignparentbottom="true"
    android:layout_centerhorizontal="true" >

another thing that shrinks your tablelayout down is this:

android:paddingbottom="@dimen/activity_vertical_margin"
android:paddingleft="@dimen/activity_horizontal_margin"
android:paddingright="@dimen/activity_horizontal_margin"
android:paddingtop="@dimen/activity_vertical_margin"

in the parent relativelayout. if the first step does not suit your needs, you can try setting lower paddingleft and paddingright values.

score:0

try this edit

    <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"

tools:context="com.example.funkycalc.mainactivtiy\" >

<tablelayout
    android:id="@+id/tablelayout1"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_alignparentbottom="true"
    android:layout_centerhorizontal="true" >

the padding values was the problem...


Related Query

More Query from same tag