0

新しいアクティビティを呼び出して実装しているリストビューがあります。レイアウトは次のとおりです。

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

<LinearLayout
    android:id="@+id/listWrap"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/testbutton"
    android:layout_alignParentTop="true"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/item_title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="2dp"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="20dp" >
    </TextView>

    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="false" >
    </ListView>

    <TextView
        android:id="@+id/item_subtitle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="2dp"
        android:textSize="13dp" >
    </TextView>
</LinearLayout>

<Button
    android:id="@+id/testbutton"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="@string/hello" /></RelativeLayout>

アクティビティが読み込まれると、ボタンは一番下にありますが、リスト フィールドの代わりにリストが読み込まれると、すべてのリスト項目にボタンが表示されます。このボタンを一番下に置いて、上にリストを表示するにはどうすればよいですか?

4

3 に答える 3

0

ボタンを別のレイアウトに保ち、一度チェックします

于 2012-05-29T05:25:16.343 に答える
0

グラフィカル レイアウトのビューに従って、リストビュー セットの高さを変更できます。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:layout_width="match_parent"
android:layout_height="250dp"
android:id="@+id/lv1"
android:background="#000"
android:scrollingCache="false"/>
<Button
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:text="OK"
 android:id="@+id/btnok"
 />

于 2013-10-10T12:36:46.680 に答える
-2

それを試したことはありませんが(見栄えがよくありません)、ウェイトを追加するか、ボタンにminHeightを付けようとします。

于 2012-05-28T19:40:59.293 に答える