I am already very new to Android App Development, and I am trying to achieve the next button layout in Android Studio.
[ ![App design [1]](https://fooobar.com//img/c5a9448da5b4f21c232fb260c4f86b1c.png)
I am trying to use Linear Layout, but I could not figure it out.
<LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:weightSum="1"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:background="#016eff" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_margin="10dp" android:textColor="#ffffff" android:layout_weight="0.48" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button2" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:background="#016eff" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_margin="10dp" android:textColor="#ffffff" android:layout_weight="0.48" /> </LinearLayout>
The problem with this is that if I add another button to the linear layout, then they simply flatten together, rather than adding the button to the next line.
Can someone please show me that my LinearLayout has only 2 widgets on each row or provides another fix.
Any help would be greatly appreciated :-)
source share