RecyclerView vs. ListView

前端 未结 16 2044
名媛妹妹
名媛妹妹 2020-11-22 06:07

From android developer (Creating Lists and Cards):

The RecyclerView widget is a more advanced and flexible version of ListView.

<
16条回答
  •  半阙折子戏
    2020-11-22 06:25

    In addition to above differences following are few more:

    1. RV separates view creation and binding of data to view. In LV, you need to check if convertView is null or not for creating view, before binding data to it. So, in case of RV, view will be created only when it is needed but in case of LV, one can miss the check for convertview and will create view everytime.

    2. Switching between Grid and List is more easy now with LayoutManager.

    3. No need to notify and update all items, even if only single item is changed.

    4. One had to implement view caching in case of LV. It is provided in RV by default. (There is difference between view caching n recycling.)

    5. Very easy item animations in case of RV.

提交回复
热议问题