TimePickerpublic class TimePicker extends FrameLayout A view for selecting the time of day, in either 24 hour or AM/PM mode. The
hour, each minute digit, and AM/PM (if applicable) can be conrolled by
vertical spinners. The hour can be entered by keyboard input. Entering in two
digit hours can be accomplished by hitting two digits within a timeout of
about a second (e.g. '1' then '2' to select 12). The minutes can be entered
by entering single digits. Under AM/PM mode, the user can hit 'a', 'A", 'p'
or 'P' to pick. For a dialog using this view, see
{@link android.app.TimePickerDialog}.
See the Pickers
guide.
|
Fields Summary |
---|
private static final int | MODE_SPINNER | private static final int | MODE_CLOCK | private final TimePickerDelegate | mDelegate |
Constructors Summary |
---|
public TimePicker(android.content.Context context)
this(context, null);
| public TimePicker(android.content.Context context, android.util.AttributeSet attrs)
this(context, attrs, R.attr.timePickerStyle);
| public TimePicker(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
this(context, attrs, defStyleAttr, 0);
| public TimePicker(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(context, attrs, defStyleAttr, defStyleRes);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.TimePicker, defStyleAttr, defStyleRes);
final int mode = a.getInt(R.styleable.TimePicker_timePickerMode, MODE_SPINNER);
a.recycle();
switch (mode) {
case MODE_CLOCK:
mDelegate = new TimePickerClockDelegate(
this, context, attrs, defStyleAttr, defStyleRes);
break;
case MODE_SPINNER:
default:
mDelegate = new TimePickerSpinnerDelegate(
this, context, attrs, defStyleAttr, defStyleRes);
break;
}
|
Methods Summary |
---|
public boolean | dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
return mDelegate.dispatchPopulateAccessibilityEvent(event);
| public int | getBaseline()
return mDelegate.getBaseline();
| public java.lang.Integer | getCurrentHour()
return mDelegate.getCurrentHour();
| public java.lang.Integer | getCurrentMinute()
return mDelegate.getCurrentMinute();
| public boolean | is24HourView()
return mDelegate.is24HourView();
| public boolean | isEnabled()
return mDelegate.isEnabled();
| protected void | onConfigurationChanged(android.content.res.Configuration newConfig)
super.onConfigurationChanged(newConfig);
mDelegate.onConfigurationChanged(newConfig);
| public void | onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
super.onInitializeAccessibilityEvent(event);
mDelegate.onInitializeAccessibilityEvent(event);
| public void | onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
super.onInitializeAccessibilityNodeInfo(info);
mDelegate.onInitializeAccessibilityNodeInfo(info);
| public void | onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
super.onPopulateAccessibilityEvent(event);
mDelegate.onPopulateAccessibilityEvent(event);
| protected void | onRestoreInstanceState(android.os.Parcelable state)
BaseSavedState ss = (BaseSavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
mDelegate.onRestoreInstanceState(ss);
| protected android.os.Parcelable | onSaveInstanceState()
Parcelable superState = super.onSaveInstanceState();
return mDelegate.onSaveInstanceState(superState);
| public void | setCurrentHour(java.lang.Integer currentHour)Set the current hour.
mDelegate.setCurrentHour(currentHour);
| public void | setCurrentMinute(java.lang.Integer currentMinute)Set the current minute (0-59).
mDelegate.setCurrentMinute(currentMinute);
| public void | setEnabled(boolean enabled)
super.setEnabled(enabled);
mDelegate.setEnabled(enabled);
| public void | setIs24HourView(java.lang.Boolean is24HourView)Set whether in 24 hour or AM/PM mode.
mDelegate.setIs24HourView(is24HourView);
| public void | setOnTimeChangedListener(android.widget.TimePicker$OnTimeChangedListener onTimeChangedListener)Set the callback that indicates the time has been adjusted by the user.
mDelegate.setOnTimeChangedListener(onTimeChangedListener);
| public void | setValidationCallback(android.widget.TimePicker$ValidationCallback callback)Sets the callback that indicates the current time is valid.
mDelegate.setValidationCallback(callback);
|
|