Making Tablerows same height in TableLayout using Imagebuttons in all rows (and cells)

499 views Asked by At
<?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:weightSum="3"
    android:stretchColumns="0,1,2"
    android:padding="20dp" >


    <TableRow android:layout_weight="1" >

        <ImageButton
            android:id="@+id/barbutton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:src="@drawable/bar_icon"
            android:scaleType="fitXY"
            android:adjustViewBounds="true" />

        <ImageButton
            android:id="@+id/friendsbutton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:src="@drawable/friends_icon"
            android:scaleType="fitXY"
            android:adjustViewBounds="true" />

        <ImageButton
            android:id="@+id/musicbutton"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:src="@drawable/music_icon"
            android:scaleType="fitXY"
            android:adjustViewBounds="true" />


    </TableRow>

     <TableRow android:layout_weight="1" >

        <ImageButton
            android:id="@+id/addfriends"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:src="@drawable/add_friends_icon"
            android:scaleType="fitXY"
            android:adjustViewBounds="true" />

        <ImageButton
            android:id="@+id/messages"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:src="@drawable/message_icon"
            android:scaleType="fitXY"
            android:adjustViewBounds="true" />

        <ImageButton
            android:id="@+id/help"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:src="@drawable/help"
            android:scaleType="fitXY"
            android:adjustViewBounds="true" />


    </TableRow>


    <TableRow android:layout_weight="1" >

        <ImageButton
            android:id="@+id/settings"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:src="@drawable/settings"
            android:scaleType="fitXY"
            android:adjustViewBounds="true" />

    </TableRow>



</TableLayout>

Ive tried searching everywhere and simply cant find a solution for making the rows an equal height while using imagebuttons in each cell. Ive tried with layout_weight and weightsum, but they dont make a difference. the middle row always seems to be higher than the top and bottom rows. Hope somebody can help me and put my mind at ease :) Thanks. best regards, Jakob

0

There are 0 answers