2011-04-06 142 views
0

我曾尝试使用下面的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

这会更好,如果你张贴你的整个XML – Hussain 2011-04-06 12:10:34

回答

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