Skip to content Skip to sidebar Skip to footer

Gridview Cuts Off Last Row

I have a GridView that I populate through code, the problem is that the last row it's not fully visible. I don't know why this is happening, the layout of the Activity is pretty si

Solution 1:

In GridView android:verticalSpacing or android:horizontalSpacing only works if there is another cell to give spacing between.

Even for the first cell the spacing doesn't get applied in the top but as soon as second cell is drawn the verticalSpacing property works and a gap can be observed between the cell.

In this case, the bottom cell doesn't have any other cell to show below it as a result the last cell looks like being cut from bottom.

Try giving a padding for LinearLayout in row cell. eg: android:paddingBottom="5dp"

Solution 2:

after wasting hours I found out this issue on the library i'm using in order to create a Sliding Menu: https://github.com/jfeinstein10/SlidingMenu/issues/680

I've added the following code to my BaseActivity (every activity inherits from this):

if(Build.VERSION.SDK_INT >= 21)
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);

And it did the trick. The problem seem to happen only on devices with API > 21

Post a Comment for "Gridview Cuts Off Last Row"