我像文档here一样实现了GridView。根据示例22应该出现项目/图像,具有垂直滚动,但对于我来说仅出现9个图像。为什么呢?
在GridView
的设置中猜错了什么?
<GridView
android:id="@+id/gridView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="4dp"
android:columnWidth="100dp"
android:gravity="center"
android:numColumns="9"
android:horizontalSpacing="1dp"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="horizontal"
android:stretchMode="none"
android:verticalSpacing="1dp">
getCount方法返回22,我的列表中有22个图像。
public int getCount() {
int jj = mThumbIds.length;
return mThumbIds.length;
}
private Integer[] mThumbIds = {
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5,
R.drawable.printable_number_5, R.drawable.printable_number_5
};