我有一个不对称的网格视图,网格视图的每个单元格的高度都有所不同,但是当我调用
时gv_location.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
if (firstVisibleItem > 0) {
bt_topShiftLocation.setVisibility(View.VISIBLE);
srl_locationRefresh.setEnabled(false);
} else {
srl_locationRefresh.setEnabled(true);
bt_topShiftLocation.setVisibility(View.GONE);
}
}
});
firstVisibleItem总是有0。
那么,我可以使用网格视图扩展非对称网格视图吗?
答案 0 :(得分:0)
您可以使用recyclerview http://developer.android.com/intl/es/training/material/lists-cards.html和StaggeredGridLayoutManager https://developer.android.com/intl/es/reference/android/support/v7/widget/StaggeredGridLayoutManager.html
来实现可变单元格大小的网格视图