how to use Scroller in gridview(StickyGridHeadersGridView)

148 views Asked by At

I use a gridview ( com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView ) as my activity's content view, and I need to show a auto-scroll-image as the gridview's header. I write a auto-scroll-image widget which use Scroller to do the auto-scroll action. the widget is worked well when it in the common layout, but when I use it as the gridview's header, I can't auto-scroll, it's startScroll() method totally useless, anyone know why?

1

There are 1 answers

0
Huang Jinlong On BEST ANSWER
mStickyGridHeadersGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            if (!mIsLastPage && scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
                if (mGridView.getLastVisiblePosition() + 1 - mGridView.getCount() == 0) {
                    mPage++;
                    getPictures();
                }
            }
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

        }
    });