search

Home  >  Q&A  >  body text

android - How to set ViewHolder to reuse View after dynamic addView in Recyclerview or Listview

How to set up ViewHolder to reuse View after dynamic addView in Recyclerview or listview
The number is not fixed like talking about it

伊谢尔伦伊谢尔伦2778 days ago888

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 13:27:33

    You are not adding sub-items dynamically, you are dynamically updating the data set. You only need to insert the empty collection first, add the insert data method to the adapter, and then refresh the adapter. It does not involve multiple layouts. For multiple layouts, you can write multiple ViewHolder then specify the type.

    reply
    0
  • Cancelreply