I have a questions about Recyclerview
when the types of items are dynamic.It means I don't know how many types of Recyclerview
's items.So I don't know how to write the onCreateViewHolder()
in MyAdapter extends RecyclerView.Adpter<RecylerView.ViewHolder>
.
But in fact, the items follow some laws.For example:
item1:
Text(title)
Pic(Vertical) Pic(Vertical) Pic(Vertical)
Pic(Vertical) Pic(Vertical) Pic(Vertical)
item2:
Text(title)
Pic(Horizontal) Pic(Horizontal)
Pic(Horizontal) Pic(Horizontal)
If the picture is Vertical,the column is three.If the picture is Horizontal,the column is two.And the num of pictures maybe one,two,three,four,five,six and so on,So the types I can't confirm. I am sorry because I can't show a picture.I have ask a question RecyclerView with GridView
But it doesn't solve my questions.I have see How to create RecyclerView with multiple view type?
But the types are unchanged. PS:I know the pictures are vertical or Horizontal from data.