Best way to build and handle List view with differing rows

前端 未结 2 1664
予麋鹿
予麋鹿 2021-01-26 02:56

In my app, I show data in a list view. It looks as below.

\"enter

Each row in lis

相关标签:
2条回答
  • 2021-01-26 03:03

    when you have to manage different kinds of views you should override getViewTypeCount() and getItemViewType() and you will receive a number of convertViews equals to the int returned by getViewTypeCount(). For instance, If it returns 2 you will get 2 differents convertView.

    0 讨论(0)
  • 2021-01-26 03:17

    ListView is supposedly used to relieve the coders of some burden when each row has similar repetitive pattern. Yes, for slight variations getViewType is the correct choice to implement, but I see a better solution to your problem: you should create your own linearlayout if you have a lot of customization requirement. Remember that listview itself is an expensive object to create. Create a custom linearlayout is not that hard.

    0 讨论(0)
提交回复
热议问题