LinearLayout不能填充滚动视图

12
<ScrollView android:layout_width="fill_parent" android:id="@+id/scrollView1"
        android:layout_height="fill_parent">
        <LinearLayout android:id="@+id/linearLayout1"
            android:layout_width="fill_parent" android:orientation="vertical"
            android:layout_height="fill_parent">
            <ListView android:id="@+id/listView1" android:layout_width="fill_parent"
                android:layout_height="fill_parent"></ListView>
        </LinearLayout>
    </ScrollView>

ScrollView填满整个屏幕,但LinearLayout1只填满屏幕的一小部分,大约高度为100dip。如何使LinearLayout1填满父容器?


你确定ScrollView填满了屏幕吗?你尝试在ScrollView中使用fillViewport="true"了吗? - njzk2
请查看此链接:http://nex-otaku-en.blogspot.com/2010/12/android-put-listview-in-scrollview.html - Thommy
在ScrollView中添加android:fillViewport="true"属性即可生效。 - Ashokchakravarthi Nagarajan
2个回答

32

0

在 ScrollView 中不能使用 ListView。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接