Android列表视图首先显示10个项目,然后在滚动时添加更多项目

时间:2015-04-23 07:48:02

标签: android

在此链接How to show the last item in the List View when scrolled to get new items dynamically?下,有人发布了这个"我的应用中有一个列表视图,最初显示10个项目,当我滚动到底部时,每次动态添加10个项目&# 34;

请你发布代码来实现这个,因为我在Android应用程序中也需要相同的代码。

提前致谢...

1 个答案:

答案 0 :(得分:0)

@Override
        public void onScroll(AbsListView view, int firstVisibleItem,
                int visibleItemCount, int totalItemCount) {
            // TODO Auto-generated method stub
            islast = totalItemCount > 2 && (firstVisibleItem + visibleItemCount) >= totalItemCount;



            if(islast && !loding){

                loding = true; // if add item in other thread.
                //add item process
                //and adpater.notifyDataSetChanged();
                loding = false;
            }
        }

参考。