Aditi K
Aditi K

Reputation: 1554

How to reduce space between two rows of Table Layout for android?

I want to reduce the space between two rows of the table layout ,I am using padding attribute in xml still its not working well the way i want here is my code....

please help me out to resolve this

<TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:background="@drawable/roundshape" >

        <!-- Lable Area -->

        <TableRow
            android:id="@+id/tblRwspnLbl"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_weight="1"
            android:gravity="center" 
            android:padding="1dip"
            android:background="@drawable/border">


            <TextView
                android:id="@+id/lblCust"
                android:layout_width="75dp"
                android:layout_height="wrap_content"
                android:text="@string/lblCust"
                android:textSize="14sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/lblPros"
                android:layout_width="75dp"
                android:layout_height="wrap_content"
                android:text="@string/lblPros"
                android:textSize="14sp"
                android:textStyle="bold" />
        </TableRow>
        <!-- Spinner Area -->

        <TableRow
            android:id="@+id/tblRwspn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_weight="1"
            android:gravity="center"
            android:padding="1dip"
            android:background="@drawable/border" >

            <Spinner
                android:id="@+id/spnCust"
                android:layout_width="75dp"
                android:layout_height="35dp"
                android:fontFamily="verdana,arial,helvetica"
                android:hint="@string/SelectCust"
                android:textSize="14sp" />

            <Spinner
                android:id="@+id/spnPospect"
                android:layout_width="75dp"
                android:layout_height="35dp"
                android:fontFamily="verdana,arial,helvetica"
                android:hint="@string/SelectProspect"
                android:textSize="14sp" />
        </TableRow>
        <!-- Text Area -->

Here is my image ... want to remove space indicated in redmark enter image description here

Upvotes: 2

Views: 7942

Answers (2)

Damien R.
Damien R.

Reputation: 3373

Try to remove/modify your margin in your TableRow

<TableRow
    android:id="@+id/tblRwspnLbl"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"   <-- Reduce or remove this line
    android:layout_weight="1"
    android:gravity="center" 
    android:padding="1dip"
    android:background="@drawable/border">

Upvotes: 2

kalyan pvs
kalyan pvs

Reputation: 14590

remove this android:layout_margin="5dp" tag in TableRow

Upvotes: 1

Related Questions