Android ScrollView无法正常工作

时间:2012-08-26 13:39:49

标签: java android scrollview

我有一个布局,当内容溢出屏幕时我想要滚动。 我有以下布局xml设置。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:id="@+id/ScrlView" 
     xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
     android:layout_height="fill_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:isScrollContainer="false"
    android:id="@+id/home_root"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/backrepeat">
        <!-- Include Header  -->
        <include layout="@layout/main_header"/>

        <!--  Include dashboard -->
        <include layout="@layout/dashboard"/>   



</LinearLayout>
</ScrollView>

仪表板是用作菜单的图标集合。示例:click me 不幸的是,第二个包括(仪表板)现在显示'已损坏'。见屏幕: Click here

正如你所看到的,它看起来并不适合。当我删除滚动视图时,一切都很好。

我想要的是我的仪表板仍然看起来不错,但如果需要可以滚动。 我尝试了几个设置,但都给出了相同的结果。我做错了什么?

任何帮助将不胜感激:)

1 个答案:

答案 0 :(得分:1)

删除android:isScrollContainer="false",然后将android:fillViewport="true"添加到scrollView