I knew how to hide year or day in DatePickerDialog. Use reflect. But I found it didn't work on Month. I can't find field mMonthSpinner or mMonthPicker. It's very strange because I truly found them in source code.
DatePicker datePicker = findDatePicker((ViewGroup) this.getWindow()
.getDecorView());
if (datePicker != null) {
Class pickerClass = datePicker.getClass();
Field[] fields = pickerClass.getDeclaredFields();
for (Field field : fields) {
String fieldName = field.getName();
Log.d(tag,fieldName);
}
}
this code print log:
DATE_FORMAT
DEFAULT_CALENDAR_VIEW_SHOWN
DEFAULT_ENABLED_STATE
DEFAULT_END_YEAR
DEFAULT_SPINNERS_SHOWN
DEFAULT_START_YEAR
LOG_TAG
TW_DEBUG
productName
mYearSpinnerInput
mYearSpinner
mYearIncrementButton
mYearDecrementButton
mTempDate
mSpinners
mShortMonths
mCalendarView
mCurrentDate
mCurrentLocale
mDateFormat
mDayDecrementButton
mDayIncrementButton
mDaySpinner
So,you see, no month in there. Then how can I hide the month? My SDK is 4.4.2. Need Help!!!!!!!!!!