Skip items in recycler view

前端 未结 7 1209
鱼传尺愫
鱼传尺愫 2020-12-20 19:17

Hi I want to skip some items from recyclerview.

\"here

Here is the bi

7条回答
  •  攒了一身酷
    2020-12-20 19:25

    By making them View.INVISIBLE you are not removing the reserved spaces. Instead you could use View.GONE to make them invisible and allow the reserved space to be taken.

    Since you are setting the Views visible again you have to undo it with the if-else clause e.g.

    if (!download.isEmpty() && !desc_new.isEmpty()) {
        // make visible
    } else {
        // make invisible with gone e.g.
        holder.movieTitle.setVisibility(View.GONE);
        holder.imageView.setVisibility(View.GONE);
    }
    

提交回复
热议问题