2010-11-24 49 views
1

我在如何爲我的android應用程序努力create this layout[ImageShack Link]與Android佈局拼搏

我試着將幾個東西嵌套到對方,但我不斷收到錯誤,我終於有一些代碼不會像我想要的那樣。我希望我能瞭解我應該使用哪些佈局以及如何將它們嵌套在一起。

這裏是我的XML代碼:

<?xml version="1.0" encoding="utf-8"?> 

<TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> 

    <TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent" android:layout_height="fill_parent"> 

     <TextView android:text="94.6" android:id="@+id/id_number" android:layout_width="fill_parent" android:layout_height="fill_parent"></TextView> 

    </TableRow> 

    <TableRow android:id="@+id/TableRow02" android:layout_width="fill_parent" android:layout_height="fill_parent"> 

     <TextView android:text="KG" android:id="@+id/id_unit" android:layout_width="fill_parent" android:layout_height="fill_parent"></TextView> 

    </TableRow> 

    <TableRow android:id="@+id/TableRow03" android:layout_width="fill_parent" android:layout_height="fill_parent"> 

     <Button android:text="@+id/Add" android:id="@+id/add_button" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> 

     <Button android:text="@+id/View" android:id="@+id/view_button" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> 

</TableRow> 

</TableLayout> 

回答

2

我會跟RelativeLayout去,其中包括另一RelativeLayout的屏幕(大詞在這裏,剩下的)

0

的上部,整個事情我還去RelativeLayout的,也許,如果你是Android開發新的,要測試一個所見即所得的IDE你的佈局,您可以使用droiddraw ...

0

僞XML:

<Vertical LinearLayout> 

    <BigWord TextView align="center" /> 
    <Horizontal LinearLayout> 
     <TextView 1 /> 
     <TextView 2 /> 
    <Horizontal LinearLayout> 

</Vertical LinearLayout> 

<TableLayout> 

    <TableRow> 
     <TextView NothingHere /> 
     <TextView TextHere /> 
    </TableRow> 
    <TableRow> 
     <Button 1 /> 
     <Button 2 /> 
    </TableRow> 

</TableLayout> 
0

您應該嘗試使用RelativeLayout而不是TableLayout。看看這個tutorial