Eugene Eugene - 1 month ago 9
Android Question

How to split the screen with two equal LinearLayouts?

Wanna to split a screen for my app with two LinearLayouts. What parameters should I use to make exact splitting in two equal parts - first LinearLayout on the top and the second one is just under it.

Answer

Use weight parameter, roughly layout will look like this:

<LinearLayout android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent">
  <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="0dp"/>
  <LinearLayout android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="0dp"/>
</LinearLayout>
Comments