bgogetap / StickyHeaders

Easily add Sticky Headers to your RecyclerView
Apache License 2.0
521 stars 88 forks source link

Sticky header does not respect inset padding of non-sticky header #98

Closed ryandt closed 4 years ago

ryandt commented 4 years ago

The inset padding of sticky headers decrease relative to their non-sticky state. See screenshot for example. "6:30 AM" is a header that just transitioned out of its sticky state while "6:15 AM" is the header that just became sticky. The content of the header that becomes sticky shifts further to the left causing the two header states to lose vertical keyline alignment.

Screenshot_20200124-223939

Header layout:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorSurface">

    <TextView
        android:id="@+id/time_header_text_view"
        style="@style/Text.Material.Subtitle1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="@dimen/spacing_small"
        tools:text="6 AM" />

</FrameLayout>

I can see where someone might want this behavior, but for those that do not, it would be nice to have this configurable.

ryandt commented 4 years ago

Found out that there was an item decoration applied to the RecyclerView that adding spacing to each item. Pretty easy to work around.