10
我看過this answer,但使用API timepickerdialog(代碼如下)我想在我的類.java中設置timePickerMode屬性是否有可能?Android - 如何以編程方式更改timepicker模式?
public static class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the user
}
}
@DerGolem timePickerMode,(它可以是_clock_或_spinner_) – SNinja 2014-12-03 17:20:14
目前不可能在運行時,您是否介意在https://code.google處提交功能請求。 COM/p /安卓/問題/名單/? – alanv 2014-12-03 20:54:20