Skip to content

Commit

Permalink
v1.2.0 添加设置gridlayoutmanager的setSpanSizeLookup方法
Browse files Browse the repository at this point in the history
  • Loading branch information
limedroid committed Apr 16, 2017
1 parent ad45e6c commit 45a135c
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,26 @@ public int getSpanSize(int position) {

}

/**
* 设置SpanSizeLookup
*
* @param layoutManager
* @param lookup
*/
public void setGridSpanLookUp(GridLayoutManager layoutManager, final GridLayoutManager.SpanSizeLookup lookup) {
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (adapter != null) {
if (adapter.isHeaderOrFooter(position)) return 1;

return lookup.getSpanSize(position);
}
return GridLayoutManager.DEFAULT_SPAN_COUNT;
}
});
}

public boolean addHeaderView(int position, View view) {
boolean result = false;
if (view == null) {
Expand Down

0 comments on commit 45a135c

Please sign in to comment.