Android webview listview 判断到底

判断webview滑动到了底部
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
int height = (int) Math.floor(this.getContentHeight() * this.getScale());
int webViewHeight = this.getMeasuredHeight();
if(this.getScrollY() + webViewHeight >= height){
Log.i("THE END", "reached");
}
super.onScrollChanged(l, t, oldl, oldt);
}

判断listview
@Override
public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
lastVisibleIndex = arg1 + arg2 - 1;
}

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
//判断是否正在loading
if (!isLoading) {

if (scrollState == OnScrollListener.SCROLL_STATE_IDLE && lastVisibleIndex == mailAdapter.getCount()-1) {
Log.d("_________", String.format("既停下来了,又到底了!"));
if ((mails.size() % MAIL_PAGE_MAX) == 0) {
//设置为loading下一页,如果不为0则说明上一次取到的数量已经不足一次取到的最大值,也就是已经读取完毕。
setNextPage(true);
String userName = GameDataManager.sharedDataManager().getCurAccount().getUsername();
int page = (mails.size() / MAIL_PAGE_MAX) + 1;
isLoading = true;
getDownloadedParam(page, switchType);
// NBNetworkTaskManager.sharedTaskManager().getMailInboxOfUser(userName, switchType, page, MAIL_PAGE_MAX, savedMailType, this);
}
}
}
}

你可能感兴趣的:(android,listview,webview)