1

当我将 ListView 的属性:android:layout_height 设置为 wrap_content 时,它只是将列表视图中的第一项包装起来:

     ...
    <ListView android:id="@+id/points_add_list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/points_add_progress"/>

    <ImageView android:id="@+id/points_add_progress2"
        android:layout_width="fill_parent"
        android:layout_height="2dp"
        android:layout_below="@id/points_add_list"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:src="@android:color/darker_gray"/>
</RelativeLayout>
</ScrollView>

在此处输入图像描述

如果我使用例如 300dp 而不是 wrap_content,则可以看到其他一些项目。

我的列表视图适配器的自定义视图布局 XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <TextView android:id="@+id/points_add_row_title"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        style="@style/PlaneText"/>
    <RadioButton android:id="@+id/points_add_row_radio"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</LinearLayout>
4

0 回答 0