3
我想使用GridView
,它只是扩大它的高度以显示它的所有子项。这样做的原因是,我要放置GridView
以上的自定义视图,它应该随着GridView
滚动:非滚动GridView
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.myapp.myview
android:id="@+id/myview"
android:layout_width="match_parent"
android:layout_height="50dp" />
<GridView
android:id="@+id/gv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:horizontalSpacing="@dimen/spacing_small"
android:numColumns="2"
android:padding="@dimen/spacing_small"
android:verticalSpacing="@dimen/spacing_small" />
</LinearLayout>
</ScrollView>
我怎样才能做到这一点?
删除ScrollView,并尝试它 – User
这只是滚动'GridView',并将自定义视图留在顶部。我想要自定义视图滚动。 – nhaarman
将一个可滚动的视图(例如'ScrollView','ListView','GridView',...)放在另一个视图内是一个不好的主意(如果每个滚动方向都不一样)。如果你这样做,你会遇到很多问题。 – Tomik