@@ -0,0 +1,1846 @@
+package com.lovejjfg.powerrecycle;%0A%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Rect;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.view.View;%0A%0A/**%0A * Created by Joe on 2016/11/17.%0A * Email lovejjfg@gmail.com%0A *%0A */%0A%0A/**%0A * when use %7B@link android.support.v7.widget.GridLayoutManager%7D,you can use this to add specified space.%0A */%0Apublic class SpacesItemDecoration extends RecyclerView.ItemDecoration %7B%0A%0A    private int spacing;%0A    private int spanCount;%0A    private boolean showEdge;%0A    private final float pre;%0A%0A    /**%0A     *%0A     * @param space item%E4%B9%8B%E9%97%B4%E7%9A%84%E7%A9%BA%E9%97%B4%0A     * @param count %E5%88%97%E6%95%B0%0A     * @param showEdge %E6%98%AF%E5%90%A6%E6%98%BE%E7%A4%BA%E5%B7%A6%E5%8F%B3%E8%BE%B9%E7%BC%98%0A     */%0A    public SpacesItemDecoration(int space, int count, boolean showEdge) %7B%0A        this.spacing = space;%0A        this.spanCount = count;%0A        this.showEdge = showEdge;%0A        pre = spacing * 1.0f / spanCount;%0A    %7D%0A%0A    @Override%0A    public void getItemOffsets(Rect outRect, View view,%0A                               RecyclerView parent, RecyclerView.State state) %7B%0A%0A        int position = parent.getChildLayoutPosition(view);%0A        int column = position %25 3;%0A        if (showEdge) %7B%0A            outRect.left = (int) (spacing - column * pre);//left%0A            outRect.right = (int) ((column + 1) * pre);//right%0A        %7D else %7B%0A            outRect.left = (int) (column * pre);%0A            outRect.right = (int) (spacing - (column + 1) * pre);%0A        %7D%0A%0A        if (position %3C spanCount) %7B // top%0A            outRect.top = spacing;%0A        %7D%0A        outRect.bottom = spacing; // bottom%0A    %7D%0A%0A    @Override%0A    public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) %7B%0A        super.onDraw(c, parent, state);%0A    %7D%0A%0A    @Override%0A    public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) %7B%0A        super.onDrawOver(c, parent, state);%0A    %7D%0A%0A%7D%0A

add SpacesItemDecoration