Open Flavien69 opened 10 years ago
I have tried the sample app on my Nexus 5, no issues during rotation. No issues in my real life app either. It may be something more specific then rotation itself.
Are you sure? I just clone the master branch of the project and import this in android studio then I lunched it on my device and I have the issue. I have it on my nexus 5 and 4 but not on nexus 7. I really don't know why. Maybe it is the version that I cloned was wrong? Moreover in my personnal project I used : compile 'com.astuetz:pagerslidingtabstrip:1.0.1' and I have exactly the same issue.
I have experienced the same issue over the weekend. I was able to make it do the same on a Galaxy Nexus and my Nexus 5. In the end I looked at the following Stackoverflow post
I then modified the PagerSlidingTabStrip with the new line in the questions answer and then it worked. Any thoughts?
I just wanted to updated for completeness. I am not totally sure what I was seeing, but in the end I found that my delegate OnPageChnageListener seems to be given the wrong position and so I had to use the pager to get the index of the current item. This only seemed to happen when I was in landscape mode. Could this be what you were seeing?
This change https://github.com/Tuxdude/PagerSlidingTabStrip/commit/8951c8838eab327398a0763c3380607c0bb125bc should fix the issue. It is based off https://github.com/Tuxdude/PagerSlidingTabStrip/commit/4fcc6442827edd3c51656a0c7c0069cf51a104f7
You are right that the OnPageChangeListener sometimes passes a positionOffset as 1, which indicates that the current position should be chosen as position +1 instead.
Thanks for the feedback on the issue. Do we think this will make it back into the initial repo? I do not seem to be able to locate the 'org.tuxdude:pagerslidingtabstrip:1.0.1.b' release of the dependency.
I'm not the maintainer of the original repo, so I do not have an answer to your question. I needed a version of psts that I could make changes and hence created the org.tuxdude version. If you want to pull the artifacts, you need to add the following maven repo to your project: https://raw.githubusercontent.com/Tuxdude/maven-artifacts/master
For an example of how to do this in gradle, you can look at this change: https://github.com/Tuxdude/yani/commit/f6b36ba50b793e63aa3f885e127235c4aa8ac429
Same should be possible using maven as well.
I cloned the sample directory from github and I tried the app but I notice the same issue that I had in my app : If I rotate the phone, the selected tabs is shifted on the right. But I don't have this issu on my nexus 7. If someone has an explication.