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

瀑布流滑动重排 #10

Open
wangyangAndroid opened this issue Mar 1, 2016 · 0 comments
Open

瀑布流滑动重排 #10

wangyangAndroid opened this issue Mar 1, 2016 · 0 comments

Comments

@wangyangAndroid
Copy link

我要实现瀑布流第二个item 距离同一排item偏下的样式,后面的布局以此中间向下。我添加了这个
public class SpaceItemDecoration extends RecyclerView.ItemDecoration{

private int space;

public SpaceItemDecoration(int space) {
    this.space = space;
}

@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    outRect.left=space;
    outRect.right=space;
    outRect.bottom=space;
    if(parent.getChildAdapterPosition(view)==1){
        outRect.top=250;
    }
}

上拉滚动时候new footerView的时候出现UI重排 界面变成一样齐的。滚到顶部在滚下来才会正常排列。不知道是什么原因感觉是recycleView重用机制导致找不到 position =1的位置导致重排?

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

1 participant