Skip to content
Steve Hannah edited this page Jul 8, 2021 · 1 revision

Picker

<picker>javadoc

Synopsis

Picker is a component and API that allows either popping up a spinner or using the native picker API when applicable. This is quite important for some platforms where the native spinner behavior is very hard to replicate.

It includes several different "flavours", and there is a specialized alias XML tag for each flavour.

Note
Use the PickerPropertyView <radPicker> instead if you want to bind the picker to a view model property.

Usage

String Pickers

Use the <picker strings="…​"> variant to create a picker to choose between a set of strings.

<picker strings="csv:Red, Green, Blue" />
StringPickerField
StringPIckerPopup
Tip

The csv: prefix will result in the common-separated-values in this attribute to be converted into a String[] array. The above example is roughly equivalent to:

Picker myPicker = new Picker();
myPicker.setStrings(new String[]{"Red", "Green", "Blue"});

Date Pickers

Use the <datePicker> tag for a picker that allows the user to select a date..

<datePicker/>
DatePickerField
DatePickerPopup

Time Pickers

User the <timePicker> tag for a picker that allows the user to a select a time.

<timePicker/>
TimePickerField
TimePickerPopup

Date and Time Pickers

Use the <dateTimePicker> for a picker that allows the user to select both a date and time.

<dateTimePicker/>
DateTimePickerField
DateTimePickerPopup

Calendar Pickers

Use the <calendarPicker> tag for a picker that allows the user to select a date using a calendar.

<calendarPicker/>
CalendarPickerFieldAndPopup

Duration Pickers

Use the <durationPicker> tag for a picker that allows the user to select a duration in minutes and seconds.

<durationPicker/>
DurationPickerPopup

Duration Hours Pickers

Use the <durationHours> tag for a picker that allows the user to select a duration in hours.

<durationHoursPicker/>
DurationHoursPickerPopup

Duration Minutes Pickers

Use the <durationMinutes> tag for a picker that allows the user to select a duration in minutes.

<durationMinutesPicker/>
DuriationMinutesPickerFieldAndPopup

Attributes

See Picker javadocs for a full list of properties. All "setters" can be set using XML attributes.

Examples

<?xml version="1.0" encoding="UTF-8" ?>
<y safeArea="true" scrollableY="true" xsi:noNamespaceSchemaLocation="PickerSamples.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <title>Picker Samples</title>

    <spanLabel>This page demonstrates unbound pickers.</spanLabel>
    <spanLabel>For pickers bound to models see see: </spanLabel>
    <button rad-href="#RADPickerSamples">RAD Picker Samples</button>

    <label>Pick a color</label>
    <picker strings="csv:Red, Green, Blue" />

    <label>Datepicker</label>
    <datePicker/>

    <label>Timepicker</label>
    <timePicker/>

    <label>Date and Time picker</label>
    <dateTimePicker/>

    <label>Calendar Picker</label>
    <calendarPicker/>

    <label>Duration Picker</label>
    <durationPicker/>

    <label>Duration Hours Picker</label>
    <durationHoursPicker/>

    <label>Duration Minutes Picker</label>
    <durationMinutesPicker/>

</y>