getItemDecorationCount 这个方法等于0添加 不然会分割线重复添加
viewHolder.recyclerviewPhoto.setVisibility(View.VISIBLE);
LinearLayoutManager manager = new LinearLayoutManager(context);
viewHolder.recyclerviewPhoto.setLayoutManager(manager);
PhotoAdapter adapter = new PhotoAdapter(context, list.get(i).getMedia(), 1);
viewHolder.recyclerviewPhoto.setAdapter(adapter);
if (viewHolder.recyclerviewPhoto.getItemDecorationCount() == 0) {
viewHolder.recyclerviewPhoto.addItemDecoration(new GridLayoutItemDecoration(context, R.drawable.item_divider_gridview));
}
网友评论