Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GravitySnapHelper ignores RecyclerView padding in 2.0 #58

Closed
CodeBreak524 opened this issue Aug 13, 2019 · 4 comments
Closed

GravitySnapHelper ignores RecyclerView padding in 2.0 #58

CodeBreak524 opened this issue Aug 13, 2019 · 4 comments

Comments

@CodeBreak524
Copy link

In version 1.5 GravitySnapHelper respected paddings of RecyclerView, which it was attached to. For example, using helper Gravity.START to recycler with paddingLeft > 0 was correctly handled, i.e. this padding remained while snapping to next elements.
But in 2.0 this padding is ignored while snapping and this leads to layout break.

Example of used RecyclerView:

GravitySnapHelper(Gravity.START).attachToRecyclerView(recyclerView)

<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_marginLeft="0dp"
    android:layout_marginRight="0dp"
    android:clipToPadding="false"
    android:nestedScrollingEnabled="false"
    android:paddingLeft="5dp"
    android:paddingRight="5dp" />

Layout of item used seems to be insignificant for this.

@rubensousa
Copy link
Owner

I just checked this using the sample. There's a list titled "Snap start with padding" and it seems to work fine.

Can you provide a screenshot of the behavior you're looking for VS what it's like at the moment?

@VinhTranVN
Copy link

Hello @rubensousa, I have the same issue above on 2.1.0, it worked OK on 1.5, you can check the attached images, I hope they can provide more info.

version 1.5
1 5

version 2.1.0
2 1 0

@rubensousa
Copy link
Owner

@VinhTranVN thank you for the example :)

I'll check this once I have more time.

@rubensousa rubensousa added this to the 2.2.0 milestone Aug 29, 2019
@rubensousa
Copy link
Owner

Released in 2.2.0. Use this: https://github.com/rubensousa/GravitySnapHelper/blob/2.2.0/gravitysnaphelper/src/main/java/com/github/rubensousa/gravitysnaphelper/GravitySnapHelper.java#L324

By default this is false, so you need to call that and pass true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants