ListView完全不如RecyclerView吗? [英] Is ListView completely inferior to RecyclerView?

查看:85
本文介绍了ListView完全不如RecyclerView吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,Vogella似乎暗示与RecyclerView相比,ListView已被完全弃用.并没有实际弃用,而是在任何情况下ListView都不是更好的选择.这是真的?这本公共软件书建议它更新的速度可能更快.从现在起还有其他原因可以完全避免使用ListView吗?仅阅读一些示例,RecyclerView似乎在代码中增加了许多难度/卷积,因此,我希望避免使用此类代码,除非有充分的理由(动画不是一个足够充分的理由)

So, Vogella seems to suggest that ListView is completely being deprecated in comparison with RecyclerView. And not actually deprecated, but rather that there is no situation in which ListView would be a better choice. Is this true? The commonsware book suggests that it might be faster at updating. Is there any other reason to completely avoid ListView from now on? Just reading through some examples, it seems that RecyclerView adds many layers of difficulty/convolution to the code, hence my desire to avoid using such unless there's a very good reason (animation isn't a superb-enough reason)

推荐答案

RecyclerView机制包含:

RecyclerView mechanism contains:

  1. RecyclerView:ViewGroup或容器
  2. LayoutManager:负责项目的布局和布置,有3个内置的LayoutManager,即 GridLayoutManager 和StaggeredGridLayoutManager.
  3. ItemDecoration:自定义项目装饰,例如:DividerItemDecoration
  4. ItemAnimator:自定义项目动画
  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(垂直).

ListView = RecyclerView + LinearLayoutManager(Vertical).

RecyclerView机制可以轻松实现ListView,GridView,WaterFall ...,还可以通过custmom LayoutManager实现其他自定义视图.

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

这就是为什么我们将来应该使用RecyclerView.

That is why we should use RecyclerView in the future.

这篇关于ListView完全不如RecyclerView吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆