@ Nullable public final View nextView ( RecyclerView . Recycler recycler , LayoutStateWrapper layoutState , LayoutManagerHelper helper , LayoutChunkResult result ) { View view = layoutState . next ( recycler ) ; if ( view == null ) { // if we are laying out views in scrap, this may return null which means there is // no more items to layout. if ( DEBUG && ! layoutState . hasScrapList ( ) ) { throw new RuntimeException ( "received null view when unexpected" ) ; } // if there is no more views can be retrieved, this layout process is finished result . mFinished = true ; return null ; } helper . addChildView ( layoutState , view ) ; return view ; }
Retrieve next view and add it into layout this is to make sure that view are added by order