Android——RecyclerView——Recycler类——源码注释翻译:Recycler类的官方解释
2017-12-02 13:36
495 查看
/** * A Recycler is responsible for managing scrapped or detached item views for reuse. * * <p>A "scrapped" view is a view that is still attached to its parent RecyclerView but * that has been marked for removal or reuse.</p> * * <p>Typical use of a Recycler by a {@link LayoutManager} will be to obtain views for * an adapter's data set representing the data at a given position or item ID. * If the view to be reused is considered "dirty" the adapter will be asked to rebind it. * If not, the view can be quickly reused by the LayoutManager with no further work. * Clean views that have not {@link android.view.View#isLayoutRequested() requested layout} * may be repositioned by a LayoutManager without remeasurement.</p> */
一个Recycler类是用来管理报废的或者被分离的item用于重新使用。
报废视图指的是一个view仍然与他的父recyclerView有联系的但是已经被标记为删除或者重用。
典型的使用Recycler的方法是通过一个将会获取views为了一个适配器的被给予位置或者itemid的数据集的LayoutManager。
如果这个视图将被重用会被认为是污染了Adapter将会被命令去重新绑定他。
如果没有,视图将会被LayoutManager快速地重用而不需要进行进一步的工作。
清理那些没有用isLayoutRequested() requested layout方法来请求布局的视图可以由LayoutManager重新定位而不需要重新测量。
总结:Recycler类是用来管理报废或者被分离的ViewHolder用于重新使用。(相当于回收站,是RecyclerView中至关重要的一个类)
相关文章推荐
- Android——RecyclerView——RecycledViewPool类——源码注释翻译:RecycledViewPool类的官方解释
- Android——RecyclerView——LayoutManager全部源码翻译及注释 3000行代码 看到崩溃
- Android——RecyclerView——ViewHolder全部源码及翻译、注释
- Android——Observable——源码注释翻译:Observable类的官方解释——秒懂
- Android——RecyclerView——Recycler类全部源码翻译及注释
- Android——RecyclerView——Adapter全部源码翻译及注释
- Android开发学习之路-RecyclerView的Item自定义动画及DefaultItemAnimator源码分析
- 基于Android官方Paging Library的RecyclerView分页加载框架
- Android Web App官方文档翻译第三章:WebView构建应用
- Android RecyclerView下拉刷新的实现和源码分析
- Android RecyclerView源码学习
- 基于Android官方AsyncListUtil优化改进RecyclerView分页加载机制(一)
- 下载Android源码(Google官方文档翻译)
- Android官方DataBinding(三):RecyclerView 使用ViewDataBinding更新数据
- Android RecyclerView上拉加载更多的实现和源码分析
- Android应用开发揭秘的第7个程序5_2_SurfaceViewDrawCircle修改版和高仿版的源码注释
- Android RecyclerView源码分析
- RecyclerView官方文档翻译
- Android官方DataBinding(三):RecyclerView 使用ViewDataBinding更新数据
- Android源码IInterface.IBinder,Parcelable的注释翻译