| Platform | Since |
|---|---|
| Android | 0.8 |
| iPhone | 0.8 |
| iPad | 0.8 |
| Mobile Web | 1.8 |
A Picker is created by the method Titanium.UI.createPicker. A Picker can be used to select one or more fixed values.
For Android, note the useSpinner property above. By default, when you create a picker you will get Android's native picker control, which looks more like the classic "dropdown" widget. If you'd prefer to use something that looks more like iOS's picker -- which looks like one or more spinning wheels --, you can set useSpinner: true.
Titanium's Android picker control (both the native and the useSpinner variety) does not support/display views that are added to picker rows. Only the title of the row will be displayed within the control.
Titanium for Android does not support the DateTime or Count Down Timer picker type.
In this basic picker example, we create a one column picker with 4 rows.
var picker = Titanium.UI.createPicker(); var data = []; data[0]=Titanium.UI.createPickerRow({title:'Bananas'}); data[1]=Titanium.UI.createPickerRow({title:'Strawberries'}); data[2]=Titanium.UI.createPickerRow({title:'Mangos'}); data[3]=Titanium.UI.createPickerRow({title:'Grapes'}); picker.add(data);
In this example, we use a custom label for each row in a column.
var picker = Titanium.UI.createPicker(); var row = Titanium.UI.createPickerRow(); var label = Titanium.UI.createLabel({ text:text, font:{fontSize:24,fontWeight:'bold'}, color:text, width:'auto', height:'auto' }); row.add(label); picker.add(row);
| Name | Summary |
|---|---|
| add |
add an array of rows, a single row or a column to the picker |
| addEventListener |
Adds the specified callback as an event listener for the named event. |
| fireEvent |
Fires a synthesized event to any registered listeners. |
| getColumns |
Gets the value of the columns property. |
| getCountDownDuration |
Gets the value of the countDownDuration property. |
| getFormat24 |
Gets the value of the format24 property. (Android only.) |
| getLocale |
Gets the value of the locale property. |
| getMinDate |
Gets the value of the minDate property. |
| getMinuteInterval |
Gets the value of the minuteInterval property. |
| getSelectedRow |
get the selected row object for column |
| getSelectionIndicator |
Gets the value of the selectionIndicator property. |
| getType |
Gets the value of the type property. |
| getUseSpinner |
Gets the value of the useSpinner property. (Android only.) |
| getValue |
Gets the value of the value property. |
| getVisibleItems |
Gets the value of the visibleItems property. (Android only.) |
| reloadColumn |
causes the picker to reload the values from the new column. (Android, iPhone, iPad only.) |
| removeEventListener |
Removes the specified callback as an event listener for the named event. |
| setColumns |
Sets the value of the columns property. |
| setCountDownDuration |
Sets the value of the countDownDuration property. |
| setFormat24 |
Sets the value of the format24 property. (Android only.) |
| setLocale |
Sets the value of the locale property. |
| setMinDate |
Sets the value of the minDate property. |
| setMinuteInterval |
Sets the value of the minuteInterval property. |
| setSelectedRow |
set the column's row to the selected state |
| setSelectionIndicator |
Sets the value of the selectionIndicator property. |
| setType |
Sets the value of the type property. |
| setUseSpinner |
Sets the value of the useSpinner property. (Android only.) |
| setValue |
Sets the value of the value property. |
| setVisibleItems |
Sets the value of the visibleItems property. (Android only.) |
| Name | Type | Summary |
|---|---|---|
| columns | Array<Object> |
array of column values |
| countDownDuration | Number |
the duration value in milliseconds for count down timer pickers. (Note that Titanium's Android implementation does not support the countdown timer.) |
| format24 | Boolean |
(applicable only to the |
| locale | String |
the locale used for displaying Date/Time pickers values |
| minDate | Date |
the minimum Date/Time for value for date pickers |
| minuteInterval | Number |
property to set the interval displayed by the minutes wheel (for example, 15 minutes). The interval value must be evenly divided into 60; if it is not, the default value is used. The default and minimum values are 1; the maximum value is 30. (Not currently supported on Android.) |
| selectionIndicator | Boolean |
for basic picker, boolean value to indicate whether the visual selection style is shown. On the iPhone, this is a blue selected bar. |
| type | Number |
the type constant for the picker. One of |
| useSpinner | Boolean |
An indicator that you wish to use a non-native Android control that looks and behaves more like the iOS picker in the sense that the user selects values by spinning a wheel. (The native Android spinner is more like a conventional "dropdown".) Note that this option works both plain pickers, date pickers and time pickers. Set it preferably immediately when creating the picker, i.e., |
| value | Date |
the Date/Time value for date pickers |
| visibleItems | Number |
This is relevant only if you set |
| Name | Summary |
|---|---|
| change |
fired when the value of a picker row and/or column changes |