Android imitation IOS viewpager sliding progress bar
In recent projects, I encountered the following requirements: viewpager paging. If it is 6 pages (including 6 pages), use dots. If it is more than 6 pages, use the progress bar to switch. The previous interaction method is the most common. Small circles are used to represent the currently selected page. These small circles are called navigation points. This is the implementation method of many apps. When users install or upgrade applications for the first time, they will use the navigation page to tell users the main highlights of the current version. Generally, the current page consists of three parts: background picture, navigation text and sliding origin, that is, the following effects:
There will be no detailed explanation here. You can refer to the blog I wrote before: viewpager realizes the image rotation effect. Today, the viewpager progress bar switching is realized. The main logic is as follows: mainactivity.java
SlideBarView.java
Relevant unit conversion tools can be copied to your own projects for direct use. ConvertUtils.java
Customize the combination control, and then realize the relevant gestures. The idea is very clear and the code is very detailed. Here you can paste the code directly. activity_ main.xml
activity_ main.xml
popup_ window.xml
Attach the relevant resource file: shape_ slide_ bar_ bg.xml
popup_ window_ bg.9.png
The effects are as follows:
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.