Violet Giraffe
Violet Giraffe

Reputation: 33579

Using NumberPicker in Android 3

I'm trying to use the NumberPicker widget in Android 3.1. I figure it is now a standard widget, part of a public API, and not an internal widget anymore. However, it doesn't work. I can see a textEdit with "0" in it, but there are no buttons, I can't scroll it, and I can't enter a new number with keyboard, either.

Update:

Here's the xml I used for testing:

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

</LinearLayout>

By saying doesn't work I mean this: it doesn't have arrows displayed (see the screenshot), and on emulator the keyboard doesn't show up. On a real device it does, but I can't type in the text, I can only erase it.

Any suggestions? I really hate to write my own widget when there is a standard one.

Upvotes: 2

Views: 2317

Answers (1)

Janusz
Janusz

Reputation: 189444

Try to set the values that are possible in the NumberPicker via

setMaxValue setMinValue or setDisplayedValues

maybe the NumberPicker is not working if it doesn't know which values to display.

Upvotes: 6

Related Questions