How to do such a layout in xml? Android
I want a Layout that is as big as the screen with two rows and three columns
开发者_JS百科like that image => http://dl.dropbox.com/u/2024237/Bildschirmfoto-DroidDraw.png
the colors should be buttons...
please help .... i cant figure it out
Using LinearLayouts and setting the children to fill_parent on both width and height and assigning them the same layout_weight you would get the desired effect:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:text="Button 1"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></Button>
<Button
android:text="Button 2"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></Button>
<Button
android:text="Button 3"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></Button>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:text="Button 4"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></Button>
<Button
android:text="Button 5"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></Button>
<Button
android:text="Button 6"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></Button>
</LinearLayout>
</LinearLayout>
精彩评论