I have my home screen code that needs to be split into two equal parts. How do I split a linear layout into two columns of equal size?
I have my home screen code that needs to be split into two equal parts. How do I split a linear layout into two columns of equal size?
You can use weight:
layout_weight= "1"
If the elements have the same weight, they will be the same size.
Example:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true">
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
Follow documentation .
Greetings