我想在单击 DatePickerDialog 时显示月份名称,但它显示月份编号
这是我的代码
tvDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int day = calendar.get(Calendar.DAY_OF_WEEK);
int month = calendar.get(Calendar.MONTH);
int year = calendar.get(Calendar.YEAR);
dpd = new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int nYear, int nMonth, int nDay) {
calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault());
tvDate.setText(nDay + "/" + (nMonth+1) + "/" + nYear);
}
}, year, month, day);
dpd.show();
}
});
月关宝盒
慕田峪9158850
相关分类