Is ListView completely inferior to RecyclerView?

…衆ロ難τιáo~ 提交于 2019-12-04 05:38:36

RecyclerView mechanism contains:

  1. RecyclerView: A ViewGroup or Container
  2. LayoutManager: Responsible for the layout and the arrangement of items, there are 3 built-in LayoutManagers, LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager.
  3. ItemDecoration: Custom item decoration, for example: DividerItemDecoration
  4. ItemAnimator: Custom item animation

ListView = RecyclerView + LinearLayoutManager(Vertical).

RecyclerView mechanism can implement ListView, GridView, WaterFall... easily, and also can implement other custom views by custmom LayoutManager.

That is why we should use RecyclerView in the future.

I believe the listview will be phased out eventually, but you will always be able to use it. I use listviews in drawer layouts for example. since drawers usually dont have that many items in them to begin with, the viewholder pattern doesnt really apply. So its much simpler to use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!