DatePickerDialog使用
2018-01-08 09:52
176 查看
调用
DatePickerDialog dialog = new DatePickerDialog(MainActivity.this, THEME_HOLO_LIGHT, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { //对选择的日期进行处理 }, int year,int month-1,int day); dialog.show();
THEME_HOLO_LIGHT : theme设置
请参考:http://blog.csdn.net/lckj686/article/details/19552793
修改显示的条目数:年、月、日的选择:
不显示日:
DatePicker dp = findDatePicker((ViewGroup) dialog1.getWindow() .getDecorView()); if (dp != null) { View view = ((ViewGroup) ((ViewGroup) dp.getChildAt(0)) .getChildAt(0)).getChildAt(2); view.setVisibility(View.GONE); }
private DatePicker findDatePicker(ViewGroup group) { if (group != null) { for (int i = 0, j = group.getChildCount(); i < j; i++) { View child = group.getChildAt(i); if (child instanceof DatePicker) { return (DatePicker) child; } else if (child instanceof ViewGroup) { DatePicker result = findDatePicker((ViewGroup) child); if (result != null) return result; } } } return null; }请参考:http://blog.csdn.net/lzt623459815/article/details/8479991
相关文章推荐
- 使用DatePickerDialog制作日期选择器
- Android日期选择器DatePickerDialog的使用
- DatePickerDialog和EditText配合使用
- 时间设置对话框 DatePickerDialog的使用
- DatePicker及DatePickerDialog的基本使用方法
- Android 日期选择器DatePickerDialog 的使用
- 使用Android DatePickerDialog 完成实战需求
- DatePickerDialog的使用
- 组件的使用(四)DatePickerDialog和TimePickerDialog的使用
- DatePickerDialog和TimePickerDialog使用示例
- DatePickerDialog的使用
- Android中DatePickerDialog对话框和TimePickerDialog对话框的使用
- DatePickerDialog的使用
- DatePicker 和 DatePickerDialog的基本使用方法
- Android DatePickerDialog使用案例
- DatePickerDialog和TimePickerDialog使用示例
- DatePickerDialog和TimePickerDialog的简单使用
- Android DatepickerDialog(日期选择器)的使用
- DatePicker和DatePickerDialog的基本使用方法
- DatePickerDialog的使用