Reputation: 3241
Basically I want to get a Layout that behaves like a Java GridLayout.
I tried LinearLayout and TableRow but the elements are always added after each other.
Whats the best way to achieve this (using the xml approach)?
Upvotes: 0
Views: 356
Reputation: 3241
Solved it:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" >
<Button
android:id="@+id/button1"
style="@style/ButtonStyle"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/main_buttons"
android:text="@string/sGet"
android:layout_weight="1" />
<Button
android:id="@+id/button2"
style="@style/ButtonStyle"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/main_buttons"
android:text="@string/sStop"
android:layout_weight="1" />
<Button
android:id="@+id/button3"
style="@style/ButtonStyle"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/main_buttons"
android:text="@string/sSettings"
android:layout_weight="1" />
<Button
android:id="@+id/button4"
style="@style/ButtonStyle"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/main_buttons"
android:text="@string/sExit"
android:layout_weight="1" />
</LinearLayout>
Upvotes: 0