Do spinners natively allow int arrays in android?
I've looked around but I couldn't find any answers. Anyway, as the title says is there any way I can set a spinner from an int array in android? For example what I am trying to do is set a max value ranging from 1 to any max number (i'll call it 'n') and the user has to select a number from one to the max number.
Right now I am trying to populate an int array from 1 to the max number, however that will take O(n) comp开发者_如何学Clexity and I cannot figure out how to actually put the int values in the spinner. Can someone please help me out? thanks!
You can use an array of strings with the string values of the ints--
that's the trivial way.
But for something like this I'd think about using a SeekBar
Use and array just like normal. Created your spinner and the spinners adapter and give the adapter the array full of the numbers up to N
.
精彩评论