android - How would I make a grid layout occupy 1/2 of a screen? -
my current thinking use horizontal linearlayout 1/2 weightsum not make linearlayout occupy 1/2 of screen (which have allowed me place gridlayout on top).
how make gridlayout occupy upper 1/2 of screen?
try setting weightsum
attribute on parent linearlayout
.
in following example, weight of gridlayout
1
out of total 2
(so 1 half).
<linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightsum="2"> <gridlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/> </linearlayout>
Comments
Post a Comment