@@ -0,0 +1,3161 @@
+package com.marshalchen.ultimaterecyclerview;%0A%0Aimport android.content.Context;%0Aimport android.support.v7.widget.LinearLayoutManager;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0A%0A/**%0A * Created by cym on 15/5/27.%0A */%0Apublic class CustomLinearLayoutManager extends LinearLayoutManager %7B%0A%0A    public CustomLinearLayoutManager(Context context, int orientation, boolean reverseLayout)    %7B%0A        super(context, orientation, reverseLayout);%0A    %7D%0A%0A    private int%5B%5D mMeasuredDimension = new int%5B2%5D;%0A%0A    @Override%0A    public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state,%0A                          int widthSpec, int heightSpec) %7B%0A        final int widthMode = View.MeasureSpec.getMode(widthSpec);%0A        final int heightMode = View.MeasureSpec.getMode(heightSpec);%0A        final int widthSize = View.MeasureSpec.getSize(widthSpec);%0A        final int heightSize = View.MeasureSpec.getSize(heightSpec);%0A        int width = 0;%0A        int height = 0;%0A        for (int i = 0; i %3C getItemCount(); i++) %7B%0A            measureScrapChild(recycler, i,%0A                    View.MeasureSpec.makeMeasureSpec(i, View.MeasureSpec.UNSPECIFIED),%0A                    View.MeasureSpec.makeMeasureSpec(i, View.MeasureSpec.UNSPECIFIED),%0A                    mMeasuredDimension);%0A%0A            if (getOrientation() == HORIZONTAL) %7B%0A                width = width + mMeasuredDimension%5B0%5D;%0A                if (i == 0) %7B%0A                    height = mMeasuredDimension%5B1%5D;%0A                %7D%0A            %7D else %7B%0A                height = height + mMeasuredDimension%5B1%5D;%0A                if (i == 0) %7B%0A                    width = mMeasuredDimension%5B0%5D;%0A                %7D%0A            %7D%0A        %7D%0A        switch (widthMode) %7B%0A            case View.MeasureSpec.EXACTLY:%0A                width = widthSize;%0A            case View.MeasureSpec.AT_MOST:%0A            case View.MeasureSpec.UNSPECIFIED:%0A        %7D%0A%0A        switch (heightMode) %7B%0A            case View.MeasureSpec.EXACTLY:%0A                height = heightSize;%0A            case View.MeasureSpec.AT_MOST:%0A            case View.MeasureSpec.UNSPECIFIED:%0A        %7D%0A%0A        setMeasuredDimension(width, height);%0A    %7D%0A%0A    private void measureScrapChild(RecyclerView.Recycler recycler, int position, int widthSpec,%0A                                   int heightSpec, int%5B%5D measuredDimension) %7B%0A        View view = recycler.getViewForPosition(position);%0A        if (view != null) %7B%0A            RecyclerView.LayoutParams p = (RecyclerView.LayoutParams) view.getLayoutParams();%0A            int childWidthSpec = ViewGroup.getChildMeasureSpec(widthSpec,%0A                    getPaddingLeft() + getPaddingRight(), p.width);%0A            int childHeightSpec = ViewGroup.getChildMeasureSpec(heightSpec,%0A                    getPaddingTop() + getPaddingBottom(), p.height);%0A            view.measure(childWidthSpec, childHeightSpec);%0A            measuredDimension%5B0%5D = view.getMeasuredWidth() + p.leftMargin + p.rightMargin;%0A            measuredDimension%5B1%5D = view.getMeasuredHeight() + p.bottomMargin + p.topMargin;%0A            recycler.recycleView(view);%0A        %7D%0A    %7D%0A%7D%0A

add CustomLinearLayoutManager