如下是常见的GridView,红色是显示的图片,绿色加号是增加图片的按钮,如何实现这样的效果?
第一个思路,是在数据list最后位置增加一个加号图片数据,但这样改动原始list数据的方法显然不好,牵扯很多。
第二个思路,是在Adapter里面的数据list最后一个位置增加加号图片数据,但是,为了显示一个按钮而变动正常数据list总是不妥的。再有一点,Adapter中数据list的头指针是自己的,list里面的items数据项可能和外面的list共享的,也即可能是同一体。可能是这样,这点我没细看。
第三个思路是我推荐的,其方法是在Adapter比对View和数据item时偷偷插入一环,
public class RvAdapterCollectPic extends Adapter<RvAdapterCollectPic.ViewHolder> {
List<LvRowFile> listItems;
pu
List<LvRowFile> listItems;
pu