Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议:网格视图下 可以封装个间距设置方法 #11

Open
Sum41forever opened this issue Apr 10, 2017 · 1 comment
Open

建议:网格视图下 可以封装个间距设置方法 #11

Sum41forever opened this issue Apr 10, 2017 · 1 comment

Comments

@Sum41forever
Copy link

现在好像只有线性的

public XRecyclerView noDivider() {
    setItemAnimator(new DefaultItemAnimator());
    setHasFixedSize(true);
    return this;
}

public XRecyclerView horizontalDivider(@ColorRes int colorRes, @DimenRes int dimenRes) {
    setItemAnimator(new DefaultItemAnimator());
    setHasFixedSize(true);
    addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext())
            .colorResId(colorRes)
            .size(getContext().getResources().getDimensionPixelSize(dimenRes))
            .build()
    );
    return this;
}

public XRecyclerView verticalDivider(@ColorRes int colorRes, @DimenRes int dimenRes) {
    setItemAnimator(new DefaultItemAnimator());
    setHasFixedSize(true);
    addItemDecoration(new VerticalDividerItemDecoration.Builder(getContext())
            .colorResId(colorRes)
            .size(getContext().getResources().getDimensionPixelSize(dimenRes))
            .build()
    );
    return this;
}
@limedroid
Copy link
Owner

感谢反馈 @Sum41forever

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants