search

Home  >  Q&A  >  body text

android - How to hide items in recyclerview

Help:
How to hide any item in recyclerview, I have tried http://blog.csdn.net/u0110601... and http://blog.csdn.net/rgen_xia...,
did not succeed,

The layoutparams obtained in onBindViewHolder is null, and params.height cannot be set.
Getting the highest level in itemview also cannot obtain params

仅有的幸福仅有的幸福2743 days ago869

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 13:23:42

    The reason why you get the layoutparams as null is that you did not give it to the parent when you LayoutInfalter. When you infalter, you gave the parent parameters, and then you can get them. Then if you want to hide a certain one, just visible gone height 0.

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:23:42

    Can’t you just remove the corresponding item from the array?

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 13:23:42

    can’t get itLayoutParams, 你可以new ViewGroup.LayoutParams(...)然后View#setLayoutParams(...)ah

    reply
    0
  • Cancelreply