RecyclerView footer to populate parent

I have a RecyclerView with a vertical StaggeredGridLayoutManager . My layout is very simple:

 AB C1 C2 C3 F 

All items except A and B have setFullSpan(true) (set to onCreateViewHolder() ). Often Cn items are enough to scroll up and down. In this case, F has its "natural" height, and all is well. But sometimes there are not enough C elements. In this case, I want to see F (before I switched from ListView to RecyclerView , it was my footer) to fill the screen, for example

 AB C1 C2 F 

I could not find a way to define this as RecyclerView.ItemDecoration.getItemOffsets() , because I do not see the position of my F view when this method is called.

Also, it seems that StaggeredGridLayoutManager.findLastCompletelyVisibleItemPositions() sometimes gives the wrong answers.

By the way, I'm testing 4.4.2, so there may be problems with com.android.support:recyclerview-v7 .

+4
source share

All Articles