Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would one implement a NumberPicker in Android API 7?

Tags:

android

There's a NumberPicker widget in API 11, but I'm building for a minimum API of 7. How would I go about implementing one? Is there a custom widget that I can use, or is there a way to get at the components that make up DatePicker / TimePicker?

like image 489
InsanityOnABun Avatar asked Feb 09 '12 03:02

InsanityOnABun


2 Answers

I find this one very good and flexible given that there were few ready made options available at that api level at the beginning of 2012 when this question was asked.

http://code.google.com/p/android-wheel/

EDIT: So what if IOS has a similar looking control. That does not make this answer bad. Android is about freedom of choice. Besides, the look of this control is dependent on styles. Take away the shadow, add blue highlights and it looks identical to the Android 4 time picker which is what the OP was asking for.

I am pointing to a possible solution to a persons problem. I am NOT advocating that Android apps should look like IOS apps and I personally hate Android apps that are badly ported so they are a clone of their IOS versions. Some people really are fanboys.

like image 78
Kuffs Avatar answered Oct 22 '22 03:10

Kuffs


copy the NumberPicker's code in API11 to your project.

xuyao's post doesn't work. The NumberPicker has API11-dependencies (android.animator.*) which cannot be easily replaced. You have to take one of the given libraries.

like image 37
damaxxed Avatar answered Oct 22 '22 04:10

damaxxed