I have searched google and stackoverflow thoroughly, but the only answer I get is: set each Tablerow
with layout weight = "1"
. This doesnt work.
Now I have eight rows in a TableLayout
, and each contains 5 LinearLayouts
. Each of the LinearLayouts contains 2 TextViews
, and the FontSizes
vary from TextView
to TextView
.
It turns out that the TableRows vary in height, depending on the Fontsizes of the contained TextViews
.
Strangely enough, it doesnt have any impact on the layout whether I set the layout_height of the TableRows to "0dp" or to "match_parent" or "fill_parent".
How can I force the TableRows
to have the same height? I dont want to use a specific pts value as height, because the tableRows must divide the whole screen equally between themselves.
Here is part of the xml, the actual file is huge:
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:weightSum="8"
tools:context=".MainActivity" >
<TableRow
android:layout_width="match_parent"
android:layout_weight="1"
tools:context=".MainActivity">
<LinearLayout
android:clickable="true"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/btnmargintop"
android:layout_marginBottom="@dimen/btnmarginbot"
android:layout_marginLeft="@dimen/btnmarginleft"
android:layout_marginRight="@dimen/btnmarginright"
android:layout_weight="1"
android:background="@drawable/bg" >
<myapp.TypefacedTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="@integer/layoutweight1"
android:layout_gravity="center"
stevens:typeface="myfont.otf"
android:clickable="false"
android:textSize="@dimen/fontsize1" />
<myapp.TypefacedTextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="@integer/layoutweight2"
android:layout_gravity="center"
stevens:typeface="myfont.otf"
android:clickable="false"
android:textSize="@dimen/fontsize2" />
</LinearLayout>