Answer the question
In order to leave comments, you need to log in
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
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/
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();
}
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question