美文网首页Android
Recyclerview中嵌套Recyclerview添加分割线

Recyclerview中嵌套Recyclerview添加分割线

作者: piapiapia0708 | 来源:发表于2021-03-19 19:52 被阅读0次

    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));
             }
    

    相关文章

      网友评论

        本文标题:Recyclerview中嵌套Recyclerview添加分割线

        本文链接:https://www.haomeiwen.com/subject/dhjbcltx.html