0
我想让ListView的全屏尺寸,但每次在我的滚动视图中,我只能看到ListView的一个项目。 有我的代码:Android:不能让ListView的全尺寸
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<!-- progress -->
<ProgressBar android:id="@+id/login_progress" style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:visibility="gone" />
<ScrollView android:id="@+id/main_form" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ListView
android:id="@+id/countriesList"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
</ScrollView>
</LinearLayout>
这是它的外观:
我怎么想使它看起来:
我无法实现这没有ListView的harcode高度。
两件事情; 1.你的'listview'应该总是'wrap_content'并且你的父线性布局应该是'match_parent',并且2.你不应该在scrollview中包装你的列表视图。如果你想嵌套滚动,你应该使用recyclerview – tyczj
@tyczj谢谢你的建议。我被删除滚动视图:) – neustart47