jpardogo / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
2.19k stars 354 forks source link

Problem maintaining tab highlight upon orientation change #33

Closed MizzleDK closed 9 years ago

MizzleDK commented 9 years ago

I'm experiencing a slightly strange issue, and for whatever reason it only occurs on my Nexus 5, but not on my Nexus 9. It's kind of hard to describe, so I'll start with some screenshots.

This is what the application looks like to begin with:

device-2014-12-01-001835

As you can see, there are a number of tabs, starting with "All movies", "Favorites" and "New releases". Whenever I swipe to a tab that's not the first tab, it messes up the highlighting upon orientation change.

Here's an example, starting with the "New releases" tab selected:

device-2014-12-01-001919

Rotate the device, and this is what it looks like:

device-2014-12-01-001944

As you can see, it doesn't look right. Here's a screenshot of what it looks like when I scroll the tabs a bit:

device-2014-12-01-001956

Once I start scrolling the actual content, it fixes itself immediately:

device-2014-12-01-002006

silviuapostu commented 9 years ago

I am experiencing this as well on a device with KitKat 4.4.4

MDXDave commented 9 years ago

Same here (HTC One 4.4.3 and Nexus 7 5.0)

jpardogo commented 9 years ago

Does it only happen when you start with a tab that is not the first one as the first selected one?

MizzleDK commented 9 years ago

It works correctly with the first tab, but not with any of the others. On Dec 2, 2014 12:11 PM, "Javier Pardo de Santayana Gómez" < notifications@github.com> wrote:

Does it only happen when you start with a tab that is not the first one as the first selected one?

— Reply to this email directly or view it on GitHub https://github.com/jpardogo/PagerSlidingTabStrip/issues/33#issuecomment-65215137 .

jpardogo commented 9 years ago

A ok, I will take a look when I have a moment. thanks for reporting

frakc commented 9 years ago

Seems thos two issues are connected https://github.com/jpardogo/PagerSlidingTabStrip/issues/40

sockeqwe commented 9 years ago

It also seems that the correct tab is highlighted if I jump to a certain page in the ViewPager.setCurrentItem(int position) fromActivities.onCreate() ... Maybe a simple fix would be to add a OnPredrawDrawListener and set the highlighted Tab by using ViewPager.getCurrentItem()

jpardogo commented 9 years ago

Fix on PR #51