Java 与Android布局抗争
我正在努力为我的android应用程序创建[ImageShack链接] 我试着把几个东西嵌套在一起,但我不断地出错,最后我得到了一些代码,但这些代码并没有达到我想要的效果。我希望我对应该使用什么布局以及如何将它们嵌套在一起有一个想法 以下是我的XML代码:Java 与Android布局抗争,java,android,Java,Android,我正在努力为我的android应用程序创建[ImageShack链接] 我试着把几个东西嵌套在一起,但我不断地出错,最后我得到了一些代码,但这些代码并没有达到我想要的效果。我希望我对应该使用什么布局以及如何将它们嵌套在一起有一个想法 以下是我的XML代码: <?xml version="1.0" encoding="utf-8"?> <TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_
<?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>
我会选择RelativeLayout
作为屏幕上部的另一个RelativeLayout
(这里是大字,其他都是)我会选择RelativeLayout
作为屏幕上部的另一个RelativeLayout
(这里是大词,其余的都是大词)我也会选择RelativeLayout,也许,如果你是android开发新手,想在wysiwyg ide上测试布局,你可以使用droiddraw…我也会选择RelativeLayout,也许,如果你是android开发新手,想在wysiwyg ide上测试布局,你可以使用droiddraw…伪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>
伪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>
你应该尝试使用相对布局,而不是表格布局。检查这个你应该尝试使用相对布局,而不是表格布局。检查这个我想,你可以在ViewFlipper.下使用TableLayout。对所有文本和按钮使用TableRow,也可以使用a在表布局中指定“stretchColumns”,这将帮助您添加所需的列数
您也可以从本网站获得帮助-
这对我很有帮助。我认为,您可以在ViewFlipper.下使用TableLayout,对所有文本和按钮使用TableRow,还可以在TableLayout中使用属性“stretchColumns”,这将帮助您添加所需的列数
您也可以从本网站获得帮助-
这对我帮助很大