1

我想在列表视图的最后一项可见时显示上移按钮,并在列表视图的第一项可见时显示下移按钮

我试过像:

lv.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
            final int lastVisibleItem = firstVisibleItem + visibleItemCount;
            if(lastVisibleItem == totalItemCount)
            {
                imgView.setBackgroundResource(R.drawable.move_up);
            }else
                imgView.setBackgroundResource(R.drawable.move_down);

        }
    });

但它不起作用..请帮我解决这个问题。

4

0 回答 0