【发布时间】:2015-09-24 23:25:03
【问题描述】:
我想将 ListView 的高度设置为 auto,这意味着我的项目将添加到 listview,然后高度也会自动增加。
<ScrollView
android:id="@+id/abcd_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/blur_default_img">
<RelativeLayout
android:id="@+id/profile_img_rt"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:gravity="center"
android:background="@drawable/circle_white_bg">
<com.example.RoundedImageView.RoundedImageView
android:id="@+id/profile_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/person_avatar" />
</RelativeLayout>
</RelativeLayout>
<ListView
android:id="@+id/tab_pending_list"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:layout_below="@+id/profile_layout">
</ListView>
</LinearLayout>
</ScrollView>
所以这个 xml 请仔细阅读它并建议我解决如何自动增加列表视图高度的解决方案。
【问题讨论】:
-
是的,我知道,但我已经更新了我的帖子,请仔细阅读。