Android GridView Bottom row cut in nested scrolling

I have a TabLayout inside a CoordinatorLayout set up using ViewPager. In the first fragment I have a GridView inside a SwipeRefreshLayout. I have set the nested scrolling on for GridView using gridView.setNestedScrollingEnabled(true);

It works fine for API level 21 and above. Now for API level 19 i expect the app bar to not collapse but at least the GridView should be scrollable till the end row.

Instead what’s happening is the bottom most row is not fully display, i.e. can’t scroll till the bottom of gridview. And the height that’s cut off(not scrollable) at the bottom row is visually the same height as that of the app bar.

My understanding is, if the nested view cannot be scrolled then it should just take the remaining height i.e. fill_parent, although even setting that to gridview doesn’t help.

I’ve tried all possible permutations of setting layout heights but couldn’t get it working. Could someone please guide me further?