0
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
                              <ListView
                                 android:id="@+id/_lv_labels"
                                 android:layout_width="wrap_content"
                                 android:layout_height="195dp"
                                 android:layout_marginLeft="50dp"
                                 android:layout_marginRight="40dp"
                                 android:layout_marginTop="1dp"
                                 android:choiceMode="multipleChoice"
                                 android:cacheColorHint="@drawable/white" />
                              </RelativeLayout>
                              <TableLayout 

  android:id="@+id/TableLayout01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:stretchColumns="*"
  android:gravity="bottom">
  <TableRow
  android:id="@+id/TableRow01">
   <Button
                android:id="@+id/_btn_scannewitem"
                android:layout_width="90dp"
                android:layout_height="wrap_content"
                android:layout_marginRight="2dp"
                android:background="@drawable/button_background"

                android:text="Scan New Item" />
  <Button
                android:id="@+id/_btn_saveNewItem"
                android:layout_width="90dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:background="@drawable/button_background"

                android:text="Save Your Item"
                android:visibility="gone" />
   <Button
                android:id="@+id/_btn_changeprofile"
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:background="@drawable/button_background"

                android:text="Change Profile" />
  </TableRow>

  </TableLayout>

以上是我用于显示列表视图和按钮的代码,但它不适合我提到的这种设计

我正在使用 android 应用程序,因为我想在页面底部有一个按钮。我需要列表视图来显示列表中可用的任何项目,它只显示两个项目。我想要像我在下面提到的图像。

我需要这样的设计

4

2 回答 2

0

您正在启动一个相对布局并关闭它,然后您正在启动一个表格布局,这是错误的。您的表格布局应该在相对布局的根目录内

<RelativeLayout
 <TableLayout >

   </TableLayout >                           
  </RelativeLayout>
于 2012-08-24T07:49:44.737 回答
0

您需要有一个包含 xmlns:android="http://schemas.android.com/apk/res/android" 的主父容器布局,其范围仅在末尾结束

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >



<LinearLayout
    android:id="@+id/asda"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/TableLayout01"
    android:layout_marginLeft="50dp"
    android:layout_marginRight="40dp"
    android:layout_marginTop="1dp" >

    <ListView
        android:id="@+id/_lv_labels"
        android:layout_width="wrap_content"
        android:layout_height="318dp"
        android:layout_weight="1"
        android:choiceMode="multipleChoice" />
</LinearLayout>

<TableLayout
    android:id="@+id/TableLayout01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignRight="@+id/asda"
    android:layout_marginBottom="114dp"
    android:gravity="bottom"
    android:stretchColumns="*" >

    <TableRow
        android:id="@+id/TableRow01"
        android:gravity="bottom" >

        <Button
            android:id="@+id/_btn_scannewitem"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:layout_marginRight="2dp"
            android:text="Scan New Item" />

        <Button
            android:id="@+id/_btn_saveNewItem"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dp"
            android:text="Save Your Item"
            android:visibility="gone" />

        <Button
            android:id="@+id/_btn_changeprofile"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dp"
            android:text="Change Profile" />
    </TableRow>
</TableLayout>


 </RelativeLayout>
于 2012-08-24T07:52:18.043 回答