The open source framework citypickerview is used in Android to realize the three-level linkage selection of provinces and cities
1. General
I remember when I was working on the mall project, I needed to realize the three-level linkage between provinces and cities in the address selection to facilitate users to fill in the address quickly. At that time, I used an open-source control called Android wheel. At that time, I felt very easy to use. The only trouble was that I needed to sort out and parse the XML files of provinces and cities. The idea was very simple, but the amount of code was relatively large. I found another open source component accidentally, that is, the city picker view to be introduced today.
GitHub address: crazyandcoder / citypicker
2. Achieve results
Here is a demonstration of the effect:
3. Implementation method
(1) Add dependency
(2) Code implementation
Instead of introducing the layout file, we will directly demonstrate the implementation code:
4. Instructions for use
From GitHub address: crazyandcoder / citypicker
Result return
Just pass in the context to get the information of the selected provinces, cities and regions. The result returns four items, which can be selected according to your actual needs.
Method description
The above is what Xiaobian introduced to you. In Android, the open source framework citypickerview is used to realize the three-level linkage selection of provinces and cities. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!