Implementation of viewpager prohibiting sliding in Android
preface
In many apps, the home page does not allow sliding switching (because the page is loaded), but the viewpage is used to manage frgament. It's convenient
Examples previously found on the Internet:
This customization is OK if the inherited viewpager is a lower version
But if you compile with a higher version of API, after 5.0, the above customization will become invalid,
You will find that there will be slight sliding. It can still slide
To judge whether the old one is new, just look at setonpagechangelistener
This method in the latest viewpager has been abandoned and changed to addonpagechangelistener()
Because the viewpager was changed to lazy loading before, an old version of viewpager has been retained. It was not found until recently
After improvement
summary
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.