Set the height of the table row as 0dip and set the weight as 1
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" >
This should solve your problem.
Change
<Button android:id="@+id/clientimain" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"/>
to
<Button android:id="@+id/clientimain" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"/>
it might work, it’s worth a try, in eclipse it’s right for me, as you had it in the first place, maybe you could try to clean your project (Project> clean project), because it should be right, because it
The code should look like this:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="vertical" > <TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <Button android:id="@+id/clientimain" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" /> <Button android:id="@+id/button1" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:text="Button" /> </TableRow> <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <Button android:id="@+id/button2" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button6" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:text="Button" /> </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <Button android:id="@+id/button3" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button7" android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1" android:text="Button" /> </TableRow> </TableLayout> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="vertical" > <TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <ImageButton android:id="@+id/imageButton1" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:src="@drawable/ic_launcher" /> <ImageButton android:id="@+id/imageButton2" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:src="@drawable/ic_launcher" /> </TableRow> <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <ImageButton android:id="@+id/imageButton3" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:src="@drawable/ic_launcher" /> <ImageButton android:id="@+id/imageButton4" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:src="@drawable/ic_launcher" /> </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="0dp" android:layout_weight="1" > <ImageButton android:id="@+id/imageButton5" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:src="@drawable/ic_launcher" /> <ImageButton android:id="@+id/imageButton6" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:src="@drawable/ic_launcher" /> </TableRow> </TableLayout> </RelativeLayout>
still nothing changes, how big is the image size?
source share