unable to stretch rows in tablelayout, like stretchcolumns


This worked, after I used weightSum and weight parameters.

<?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"
	android:orientation="vertical" android:layout_gravity="bottom|top"
	android:background="@drawable/homescreenback" android:weightSum="4"
	android:paddingLeft="20px">
	<TableRow android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:layout_weight="1">
		<Button android:id="@+id/shop1" android:text="@string/shop1"
			android:layout_gravity="left|center" android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:background="@drawable/icon" />
	</TableRow>
	<TableRow android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:layout_weight="1">
		<Button android:id="@+id/shop2" android:text="@string/shop2"
			android:layout_gravity="left|center" android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:background="@drawable/icon" />
	</TableRow>
	<TableRow android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:layout_weight="1">
		<Button android:id="@+id/shop3" android:text="@string/shop3"
			android:layout_gravity="left|center" android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:background="@drawable/icon" />
	</TableRow>
	<TableRow android:layout_width="fill_parent"
		android:layout_height="wrap_content" android:layout_weight="1">
		<Button android:id="@+id/shop4" android:text="@string/shop4"
			android:layout_gravity="left|center" android:layout_width="wrap_content"
			android:layout_height="wrap_content" android:background="@drawable/icon" />
	</TableRow>

</TableLayout>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s