void showDatePickerDailog() {
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
DatePickerDialog datePicker = new DatePickerDialog(mContext, datePickerListener,
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH));
datePicker.setCancelable(false);
((ViewGroup) datePicker.getDatePicker()).findViewById(Resources.getSystem().getIdentifier("day", "id", "android")).setVisibility(View.GONE);
long timeadj = 24*60*60*1000;
datePicker.getDatePicker().setMinDate((new Date().getTime())+timeadj);
datePicker.show();
}
我尝试了上面的代码,但它崩溃了。如何禁用datepicker
标题?
答案 0 :(得分:0)
删除对话框标题在dialog.show()
之前添加以下代码段。
datePicker.requestWindowFeature(Window.FEATURE_NO_TITLE);
答案 1 :(得分:-1)
AlertDialog
使用setCustomHeader
方法,使用它并设置宽度为zero
,zero
的自定义视图。它会起作用
LinearLayout linearLayout = new LinearLayout(getApplicationContext());
timePickerDialog.setCustomTitle(linearLayout);