我按照Android教程(链接:http://developer.android.com/guide/topics/ui/layout/gridview.html)制作图像视图。
我想只显示10张图片并制作一个按钮,点击此处可向网格添加10张图片。
我能这样做吗?答案 0 :(得分:0)
这是一个想法。
Integer[] mThumbIds
更改为动态数组,例如ArrayList<Integer> mThumbIds
(编辑:还需要将所有相关方法更改为ArrayList
方法)ImageAdapter
创建一个功能,以便向ArrayList<Integer> mThumbIds
添加更多项目,并从您的活动中轻松处理。gridview.setAdapter(new ImageAdapter(this));
使用类似的东西:
// ImageAdapter myadapter;// a field of the activity
myadapter = new ImageAdapter(this);
gridview.setAdapter(myadapter);
// ...
myadapter.methodToAddMoreItems(itemCollection); // when you need to add the items.
答案 1 :(得分:0)
https://github.com/commonsguy/cwac-endless。你需要的是一个无尽的适配器。有很多工作要做。如果你仍然有困难,请在stackoverflow中使用commonsware和android作为问题的标签。