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

Issue in RTL #185

Open
zeeshanrasool91 opened this issue Sep 5, 2017 · 14 comments
Open

Issue in RTL #185

zeeshanrasool91 opened this issue Sep 5, 2017 · 14 comments

Comments

@zeeshanrasool91
Copy link

i am facing scroll issue in RTL layout

@AndroidDeveloperLB
Copy link

You should explain the issue, so that people could find how to solve it.

@zeeshanrasool91
Copy link
Author

Yes i was using rosetta library for language change, when i change language to arabic and orientation changes i cannot perform scrolling on it

@zeeshanrasool91
Copy link
Author

zeeshanrasool91 commented Dec 27, 2017 via email

@AndroidDeveloperLB
Copy link

I'm not the owner of this repo. I think you should show a minimized sample project, that introduces the issue.

@zeeshanrasool91
Copy link
Author

okay Man Should i Share GIF with issue or Sample Project or APK file

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Dec 27, 2017

I think I know what you are talking about RTL. However, I think it's an issue on ViewPager itself, so I've reported about this here:
https://issuetracker.google.com/issues/71339606

The only workaround is to make some calculations to handle this. For example, to get the current item, you will have to substract from the entire collection.

Example: in LTR, you use itemsList.get(pos)
In RTL, you use itemsList.get(itemsList.size()-pos)

I think there are some repos that demonstrate how to deal with RTL on ViewPager.

@zeeshanrasool91
Copy link
Author

zeeshanrasool91 commented Dec 29, 2017 via email

@AndroidDeveloperLB
Copy link

Please consider starring it, then.
Maybe also write your own insights about it

@zeeshanrasool91
Copy link
Author

I gave you star already loved your work man,

@zeeshanrasool91
Copy link
Author

@AndroidDeveloperLB Dear I found Something in your Code I tried to solve it by simply making reverse layout parameter true for RTL and For LTR false but for that, I have to comment your code portion

@OverRide
public void setLayoutManager(LayoutManager layout) {
super.setLayoutManager(layout);

    /*if (layout instanceof LinearLayoutManager) {
        reverseLayout = ((LinearLayoutManager) layout).getReverseLayout();
    }*/
}

then it worked.

@zeeshanrasool91
Copy link
Author

i think that might be something with your calculations

@AndroidDeveloperLB
Copy link

@zeeshanrasool91 Thanks. Sadly this will work only on RecyclerView based solutions, like yours, but the issue I wrote is about ViewPager.

@dmitrychistyakov
Copy link

Another approach for recyclerView - use
android:layoutDirection="ltr"
in xml layout with RecyclerViewPager

@AndroidDeveloperLB
Copy link

@dmitrychistyakov We are talking about ViewPager. Not RecyclerView.

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

3 participants