重命名日期选择器中的默认按钮(android)

时间:2012-10-11 09:12:03

标签: android datepicker android-alertdialog

如何在DatePicker对话框中重命名默认按钮(“SET”)?

我的对话框:

case IDD_SET_NAME:
final Calendar c = Calendar.getInstance();
myYear = c.get(Calendar.YEAR);
myMonth = c.get(Calendar.MONTH);
myDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog DatePicker = new DatePickerDialog(this, myCallBack, myYear, myMonth, myDay);
return DatePicker;

1 个答案:

答案 0 :(得分:1)

您可以将DatePickerDialog设置按钮文字更改为:

DatePickerDialog datePicker = new DatePickerDialog(this, myCallBack, myYear, myMonth, myDay);
datePicker.setButton(DatePickerDialog.BUTTON_POSITIVE, "Enter text here", datePicker);