private boolean isBottom = false; //初始设置为false
listView_main_title.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (isBottom ) {
layout_main_dian.setVisibility(View.VISIBLE);
} else {
layout_main_dian.setVisibility(View.GONE);
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
isBottom = (firstVisibleItem + visibleItemCount == totalItemCount);
//主要是这里firstVisibleItem+visibleItemCount==totalItemCount为真时,isBottom难道不用标记为真???是不是说boolean 是根据实际情况来定义的,如果结果为真那么就不用再行标记为真???
}
});
关于boolean有个疑问 ,请看注释,求各路大神指教
最新推荐文章于 2021-02-19 11:59:32 发布