gitmyhub

Android-PickerView

Java ★ 13k updated 3y ago

This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)

Android-PickerView is a Java library that adds iOS-style scrolling wheel selectors to Android apps for picking dates, times, or cascading columns of options like province and city.

JavaAndroidGradlesetup: easycomplexity 2/5

Android-PickerView is a UI component for Android apps that provides a scrolling wheel selector, the kind of spinning reel control that iOS users will recognize, where you scroll through a list of values and the one in the center is selected. The README, written primarily in Chinese, opens with an important note: the project is no longer being maintained. The older version published through the jcenter library still works, but the author now suggests downloading the source code and bringing it into your own project as a module to customize as needed.

The library offers two types of picker. One is a time picker that lets users choose a date or time in formats like year-month-day-hour-minute, or shorter combinations such as year-month only. The other is an options picker that presents one, two, or three columns of choices. A typical example in the README is selecting a Chinese province, then a city in that province, then a district in that city, where each column updates based on what was picked in the previous one. This dependent behavior is called linkage, and you can enable or disable it.

There are many customization options. You can set start and end date boundaries for the time picker, show or hide the unit labels (like the characters for year and month), make the wheel scroll endlessly in a loop, adjust text size and color, change the divider lines between items, and display the entire picker as a dialog overlay. Selections are returned to your code through a callback function that fires when the user confirms.

Installation is done by adding a Gradle or Maven dependency. The README shows code samples for creating both picker types and wiring up a listener. It also flags a specific gotcha: Android's built-in Calendar class counts months starting from zero, so January is 0 and December is 11, and you must account for this when specifying a date range or you will get off-by-one errors. Full method documentation and version history live in the project wiki.

Where it fits