滚动条未显示整个屏幕

时间:2011-04-06 12:05:49

标签: android

我使用以下XML创建了一个滚动条:

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
        <!--added more layout inside this-->
    </LinearLayout>
</ScrollView>

现在,当我正在运行我的应用程序时,如果我的应用程序没有填满整个屏幕,则会在布局下方显示黑屏。

有人知道为什么会这样吗?

1 个答案:

答案 0 :(得分:1)

您的ScrollView高度正在包裹LinearLayout的内容。

尝试将XML更改为:

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
        <!--added more layout inside this-->
    </LinearLayout>
</ScrollView>

现在,您的ScrollView应该使用整个屏幕,而不是只占用LinearLayout

相关问题