DatePicker隐藏年、月、日

datePicker = (DatePicker) inflate.findViewById(R.id.datepicker2);

1、隐藏年

((ViewGroup) (((ViewGroup)

datePicker .getChildAt(0)).getChildAt(0)))
.getChildAt(0).setVisibility(View.GONE);*/

2、隐藏月

((ViewGroup) (((ViewGroup)

datePicker .getChildAt(0)).getChildAt(0)))
.getChildAt(1).setVisibility(View.GONE);

3、隐藏日

((ViewGroup) (((ViewGroup)

datePicker .getChildAt(0)).getChildAt(0)))
.getChildAt(2).setVisibility(View.GONE);

4、隐藏日历列表

datePicker .setCalendarViewShown(false);

你可能感兴趣的:(技巧)