2010-11-24 57 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