A
A
Artem2013-03-09 13:31:54
Android
Artem, 2013-03-09 13:31:54

How to add footer to GridView?

There is a GridView with pictures. It is necessary that when a person reaches the last line, he sees a footer with the inscription "Loading ..." and a ProgressBar while a new portion of images is being loaded. How to implement it?
I tried to dynamically change the View of the last item in the GridView inside the adapter. But it doesn't stretch to full screen width.
Where to dig?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
palmut, 2013-03-09
@bartwell

Full width can be done if there was a GridLayout ... One of the options that came to mind is to show the loading component separately outside the GridView. Those. put the GridView and this loading component in the FrameLayout, set your observer setOnScrollListener(AbsListView.OnScrollListener l) and when the last element (which is now the substituted View) appears, control the visibility and the high component showing the loading - take the vertical coordinates of the component from the substituted View. Slightly this method is mentioned here habrahabr.ru/post/130319/

P
palmut, 2013-03-09
@palmut

The post I pointed to has this part:

mList.setOnScrollListener(new OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView arg0, int arg1) {}
            
            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
                if (visibleItemCount > 0 && firstVisibleItem + visibleItemCount == totalItemCount &&
                            hasNextPage()) {
                    loadNextPage();
                }
            }
    });

I
Igogo2012, 2013-03-09
@Igogo2012

There is such an extension - www.yiiframework.com/extension/yiinfinite-scroll

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question