DatePicker实现只可选择年月
final DatePicker datePicker = (DatePicker) mViewDateselect.findViewById(R.id.date_picker);
Calendar mCalendar= Calendar.getInstance(); datePicker.init(mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH), null);
//禁止弹出输入键盘
datePicker.setDescendantFocusability(DatePicker.FOCUS_BLOCK_DESCENDANTS);
LinearLayout ll = (LinearLayout) datePicker.getChildAt(0);
LinearLayout ll2 = (LinearLayout) ll.getChildAt(0);
ll2.getChildAt(2).setVisibility(View.GONE);
Integer month = datePicker.getMonth() + 1;
Integer year = datePicker.getYear();
String strMonth = (month.toString().length() == 1 ? "0" + month.toString() : month.toString());
String strYear = year.toString();