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

RTL support for GridLayoutManager #26

Open
vahid-m opened this issue Jun 7, 2022 · 1 comment
Open

RTL support for GridLayoutManager #26

vahid-m opened this issue Jun 7, 2022 · 1 comment

Comments

@vahid-m
Copy link

vahid-m commented Jun 7, 2022

GridSpanMarginDecoration now adds the horizontal margin to the items left and right as full or semi, based on the first, end, or middle position in a row. But in RTL layouts the values that have been used for left and right should be swapped.
For instance when we define 16dp as horizontal margin between items, the first position in gridlayout should have margin as below:
in LTR -> left=16 , right =8
in RTL -> left = 8, right = 16

@rubensousa
Copy link
Owner

Hey @vahid-m

All decorators use specific left/right values instead of start/end.
Typically left/right means exactly that, it doesn't change depending on LTR or RTL.

I could add support for start/end instead and add an extra RTL flag that you can get from the LayoutManager.

For now, you can on the declaration site configure those different values yourself by using this method from GridLayoutManager: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/LinearLayoutManager#islayoutrtl

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

No branches or pull requests

2 participants