Android uses Android wheel to realize the three-level linkage of provinces, cities and counties

Today, I had nothing to talk about with the group. A friend said that the Android wheel control was a built-in control of Android. Google found that it was a control on a GitHub.

Download address: https://code.google.com/p/android-wheel/ I found it very suitable for the three-level linkage of provinces, cities and counties, so I made one.

First look at the renderings:

1. First, import the wheel project on GitHub

2. Create a new project, and then select remember to right-click - > properties - > Android to add wheel as lib:

The above two steps are the process of importing all open source projects.

3. Let's start writing the code: first, the JSON file of the province and city, which is placed in the city of assets JSON:

Understand the general format first. The code will parse according to this format later

4. The layout file is relatively simple. The three wheelviews represent provinces, cities and counties respectively, and there is also a button:

5. Preparation of activity: the comments are quite detailed and will not be repeated in this section.

Source code download: http://xiazai.jb51.net/201608/yuanma/Androidwheel (jb51.net). rar

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.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>