Shopping cart

View your shopping cart.

NumberPicker

This is a widget that provides a standard Spin button control for numbers (In Android terms, a NumberPicker).   I wrote this after trying several of the other ones that are available on the web.  I wanted one that could be configured via XML, and that didn't churn memory by creating gobs of little temporary objects each time something happened.  I also wanted it to be defineable as a single XML widget in a layout, and not need a complex inter-dependent set of widgets.  It also allows acceleration, so as the user holds either of the +/- buttons down, the numbers start changing faster.

XML Attributes that may be set

  • plusminus_width - width of + and - buttons, defaults to WRAP_CONTENT
  • plusminus_height - height of + and - buttons, defaults to WRAP_CONTENT
  • textarea_width - width of text number field, defaults to WRAP_CONTENT
  • textarea_height - height of text number field, defaults to WRAP_CONTENT
  • textSize - size of text to use, integer, defaults to 25
  • vertical - specifies vertical arrangement, defaults to false
  • minValue - Minimum value allowed (defaults to 0)
  • maxValue - Maximum value allowed (defaults to 100)
  • defaultValue - default value (defaults to minValue)
  • repeatInterval - initial milliseconds between repeats (defaults to 200)
  • repeatAcceleration - Num milliseconds to decrement the repeat interval on each repeat (defaults to 0)

NumberPicker.zip