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アプリで作業しています。リストで利用可能なアイテムを表示するには、リストビューが必要です.2つのアイテムしか表示されません。私は下に述べた画像のようにしたい。

このようなデザインが必要です

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 に答える