LayoutManager { // The required bits to implement public abstract LayoutParams generateDefaultLayoutParams(); public void scrollToPosition(int position) { if (DEBUG) { Log.e(TAG, "You MUST implement scrollToPosition. It will soon become abstract"); } } public void onLayoutChildren(Recycler recycler, State state) { Log.e(TAG, "You must override onLayoutChildren(Recycler recycler, State state) "); } } }
* similar functionality to {@link android.widget.ListView}. */ public class LinearLayoutManager extends RecyclerView.LayoutManager { /* REALLY INTERESTING CODE HERE */ }
item views */ public void onDraw(Canvas c, RecyclerView parent, State state) {} /* drawn after the item views */ public void onDrawOver(Canvas c, RecyclerView parent, State state) {} /* adjusts the item insets to give space if necessary for the decoration */ public void getItemOffsets(Rect outRect, View view, RecyclerView parent, State state) {} } BIG NOTA BENE : These methods are not called of each item individually but just once for the RecyclerView
abstract public boolean animateRemove(ViewHolder holder); abstract public boolean animateAdd(ViewHolder holder); abstract public boolean animateMove(ViewHolder holder, int fromX, int fromY, int toX, int toY); abstract public boolean animateChange(ViewHolder oldHolder, ViewHolder newHolder, int fromLeft, int fromTop, int toLeft, int toTop); abstract public void endAnimation(ViewHolder item); abstract public void endAnimations(); abstract public boolean isRunning(); }
basic * animations on remove, add, and move events that happen to the items in * a RecyclerView. RecyclerView uses a DefaultItemAnimator by default. */ public class DefaultItemAnimator extends RecyclerView.ItemAnimator { /* REALLY INTERESTING CODE HERE */ }