简体   繁体   中英

Issue with ViewPagerIndicator in Android when orientation is changed

I have implemented the Jake Wharton's ViewPagerIndicator. Here, I am reloading the data when the orientation is changed.

In landscape I have 6 pages & I have scrolled to last page. The result is here 这里

Now, I have changed the orientation to portrait. Now portrait has only 4 pages. But, the result is here.

在此处输入图片说明

Here the indicator has gone out of the available items.

But, the selected page is 1.

How to resolve this issue? I have used the following line

circlePageIndicator.setCurrentItem(0);

Even then its not working?

circlePageIndicator.setCurrentItem(0); selects page at position 1?

You most likely have android:configChanges="orientation" in your manifest which is preventing the activity from restarting on orientation changes. Because of this, certain fundamental aspects of the view are changing (eg, the width) and the control isn't updating properly since you prevent recreation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM