<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/bag"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout2"
style="@style/relbag"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView style="@style/CodeFont"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="18dp"
android:textSize="15dp"
android:text="General Preference"
android:id="@+id/genpref">
</TextView>
<ListView
android:id="@+id/settingsListView1"
style="@style/listbag"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:background="@drawable/radius"
android:listSelector="@drawable/list_selector"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:scrollbars="none"
android:layout_below="@id/genpref"/>
<TextView style="@style/CodeFont"
android:id="@+id/notpref"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:textSize="15dp"
android:text="Notification Preference"
android:layout_below="@id/settingsListView1">
</TextView>
<ListView style="@style/listbag" android:id="@+id/settingsListView2" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="15dip" android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:background="@drawable/radius"
android:paddingLeft="5dip" android:paddingRight="5dip"
android:paddingTop="15dip" android:paddingBottom="15dip"
android:listSelector="@drawable/list_selector"
android:layout_below="@id/notpref"
android:scrollbars="none"
/>
</RelativeLayout>
</LinearLayout>
在我的应用我要创建两个列表视图到LinearLayout中,使LinearLayout中滚动不使用滚动型。据我看来,scrollview有一个与listview工作的问题。这张图片不是我想要的,但我们假装在listview下面有另一个listview。所以我想显示listview的所有可用项目(在我的应用程序2列表视图的项目),并使LinearLayout可滚动。 ScrollView不会很好,因为它只能有一个直接的孩子。我找不到解决方案。所以请帮我解决,谢谢
我看到了这样的其他问题不明白w^hy人们希望显示一个ListView,并显示所有可用的列表项。 “ListView”(及其滚动功能)的全部要点是它适合屏幕(或其一部分),并且可以滚动以显示不符合其占用空间的其他项目。如果你想显示一系列'项目',只需为项目创建一个视图,然后创建它的多个动态插入到'ScrollView'中,并忘记使用'ListView'。 – Squonk
参考http://stackoverflow.com/a/17876855/336990 ...可能是有用的 – CoDe