listView.setOnScrollListener(new OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
boolean enable = false;
if (listView != null & listView.getChildCount() > 0) {
boolean firstItemVisible = listView
.getFirstVisiblePosition() == 0;//listview出现第一行
boolean topOfFirstItemVisible = listView
.getLastVisiblePosition() == 0;
enable = firstItemVisible;
Log.e("------", ""+enable);
}
swipeRefreshLayout.setEnabled(enable);//当出现第一行时,让刷新控件显示。
}
});
SwipeRefreshLayout嵌套复杂布与listview冲突解决
最新推荐文章于 2022-11-24 12:12:44 发布