在我的应用程序中,滚动视图运行良好,但所有网格视图只显示部分imgebuton。我必须在每个网格中显示6个图像按钮和文本视图。3个网格写得很好,但在它下面只显示部分3个按钮。。请指导我做错了什么。
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/firstLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/latest_ringtone" >
</ImageView>
<GridView
android:id="@+id/grid1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/firstLabel"
android:gravity="center"
android:numColumns="3"
android:stretchMode="columnWidth" >
</GridView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dp"
android:gravity="right" >
<ImageView
android:id="@+id/scndLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/topofmonth" >
</ImageView>
<GridView
android:id="@+id/grid2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/scndLabel"
android:gravity="center"
android:horizontalSpacing="2dp"
android:numColumns="3"
android:stretchMode="columnWidth"
android:verticalSpacing="3dp" >
</GridView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" >
<ImageView
android:id="@+id/thrdLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/alltime_hits" >
</ImageView>
<GridView
android:id="@+id/grid3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/thrdLabel"
android:gravity="center"
android:horizontalSpacing="2dp"
android:numColumns="3"
android:stretchMode="columnWidth"
android:verticalSpacing="3dp" >
</GridView>
</RelativeLayout>
</LinearLayout>
</ScrollView>
通过扩展Gridview&override on Measure()。