[英]How to do such a layout in xml? Android
我想要一個與兩行三列的屏幕一樣大的布局
像那個圖像=> http://dl.dropbox.com/u/2024237/Bildschirmfoto-DroidDraw.png
顏色應該是按鈕...
請幫助...。我不知道
使用LinearLayouts並將子級的寬度和高度都設置為fill_parent,並為其分配相同的layout_weight,您將獲得所需的效果:
<?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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.