Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NumberPicker, DatePicker, TimePicker arrows are missing

I have seen many examples with a pair of up and down arrows on NumberPicker, DatePicker and TimePicker of Android applications. But when I use it, application show no arrows.

Are there any tricks to make the arrows shown?

The SDK is API version 17 and revision 2.

The code is pretty simple.

<DatePicker
android:id="@+id/datePicker123"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:calendarViewShown="false" />

<TimePicker
android:id="@+id/timePicker123"
android:layout_width="280dp"
android:layout_height="wrap_content" />

<NumberPicker
android:id="@+id/numberPicker123"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

Activity onCreate

String[] options = new String[] { "A", "B", "C" }
NumberPicker numberPicker123 = (NumberPicker) findViewById(R.id.numberPicker123);
numberPicker123.setMinValue(0);
numberPicker123.setMaxValue(options.length - 1);
numberPicker123.setDisplayedValues(options);
like image 746
OmniBus Avatar asked Apr 17 '13 05:04

OmniBus


1 Answers

If you are looking to change the + and - in NumberPicker to up and down arrows it doesn't look like that is doable with the default NumberPicker class, from what I've seen in the documentation and from other questions I've seen answered on Stack Overflow.

Is it possible to make a horizontal NumberPicker?

Android having NumericUpDown Button?

It doesn't look like you get a lot of control over the class, but in the second question Dave Webb offers a lot of information on how to get the NumberPicker class from android. With the source, I'm sure you can change the images.

Otherwise, you can just make your own out of a linear layout with a number field and 2 buttons.

Hope this helps.

like image 114
Andrew T. Avatar answered Sep 22 '22 10:09

Andrew T.