Reputation: 7040
I have a table layout with 5rows. I'd like the size of first row to take the rest of the screen while the remaining rows take as much space they need based on the content inside.
My first intuition was to make the first row's layout width and height set to match_parent
while having the other rows' width to match_parent
and height to wrap_content
. Needless to say, this does not work.
How can I accomplish this?
Upvotes: 2
Views: 628
Reputation: 2890
stick to your first intuition but add layout_weight="1"
to the first row.`
Upvotes: 0
Reputation: 3408
Seeing as TableLayout
inherits from LinearLayout
, have you tried setting Row height to 0dp and setting layout weights for each one to achieve the desired effect? Like so:
<TableRow
android:layout_height="0dp"
android:layout_weight="2"
android:layout_width="match_parent">
<TableRow
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent">
and so on....
Upvotes: 0
Reputation: 87074
I'd like the size of first row to take the rest of the screen while the remaining rows take as much space they need based on the content inside.
I think that using android:layout_weight="1"
on the first TableRow
should solve the problem you have.
Upvotes: 1
Reputation: 5869
Put your TableLayout
inside a ScrollView
and fix the Height of your First TableRow
which will solve your issue. Hope it works.
Upvotes: 0