Android high imitation IOS wheel selection control
Recently, according to the needs of the project, I sorted out a relatively comprehensive wheelview use control. To borrow a sentence I saw before, I stood on the shoulders of giants and made some small adjustments. Paste the effect picture here first
The commonly used time selection format, single item selection, and city linkage can be basically met here.
Here, the single item selection and date time selection are proposed to the util class. The code is as follows:
• single choice
Here is the string type in the form of simulated incoming ArrayList:
Add: in our actual project, the usage may be to pass in an entity object, so we can find the method to set the display content in wheelview:
According to the above code, you can see that if it is an entity object, the display content is the return value of a method named getpickerviewtext (static constant = "getpickerviewtext") defined inside the object,
Therefore, when creating an object, pay attention to adding a getpickerviewext() method inside the object. The code is as follows:
• date selection here is the input selection date type, and the callback time format can directly get the desired result,
• condition selection
That's all for basic use. There's no technical content. It's just sorted out as a common tool. I hope it can bring convenience to everyone.
Click download: source code
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.