Search code examples
androidandroid-gridviewandroid-scrollbar

StickyGridHeaders bug when used inside RelativeLayout


I am using TonicArtos/StickyGridHeaders library and my StickyGridHeadersGridView is placed inside a RelativeLayout. The problem is, attributes I used in layout XML for StickyGridHeadersGridView is not working because of which ScrollBar is appearing above the grid view items

android:layout_above
android:layout_below
android:layout_toRightOf

I am getting output as follows

enter image description here

Workaround Solution:

To resolve this issue I have to wrap the StickyGridHeadersGridView inside FrameLayout and I applied the above mentioned attributes to this FrameLayout and it worked just fine BUT FrameLayout here is unnecessary since it will add an Another view in view hierarchy.


Solution

  • It seems like this bug is resolved after replacing the following two lines in StickyGridHeadersGridView.java (line no 887)

    canvas.restore();
    canvas.restore();
    

    with

    if (mHeaderBottomPosition != headerHeight) {
        canvas.restore();
    }
    canvas.restore();
    

    Thanks to TonicArtos/StickyGridHeaders Issue #55