Android 从DatePickerDialog中删除标题
出于某种原因,我的DatePickerDialog中有两个标题 我怎样才能摆脱顶部的白色标题? 这是我用来创建对话框的代码:Android 从DatePickerDialog中删除标题,android,android-alertdialog,Android,Android Alertdialog,出于某种原因,我的DatePickerDialog中有两个标题 我怎样才能摆脱顶部的白色标题? 这是我用来创建对话框的代码: datePickerDialog = new DatePickerDialog(ProfileActivity.this, this, year, month, day); datePickerDialog.getDatePicker().updateDate(year, month - 1, day); datePickerDialog.show(); 我发现自己:
datePickerDialog = new DatePickerDialog(ProfileActivity.this, this, year, month, day);
datePickerDialog.getDatePicker().updateDate(year, month - 1, day);
datePickerDialog.show();
我发现自己:
datePickerDialog.getDatePicker().setMaxDate(c.getTimeInMillis())代码>
也许对你来说:
datePickerDialog.getDatePicker().updateDate(年、月-1、日)代码>
是罪魁祸首。如果你把那一行删掉,你就没有头衔了
我正在考虑设定一个特定的主题来解决这个问题
--更新--
确保调用.setTitle(“”)调用.getDatePicker().x()
后的代码>。否则它将不起作用。AlertDialog
具有setCustomHeader
方法,使用它并使用zero
宽度、zero
高度设置自定义视图。它会起作用的
LinearLayout linearLayout = new LinearLayout(getApplicationContext());
timePickerDialog.setCustomTitle(linearLayout);
更合适,甚至支持全息版本
datePickerDialog.setCustomTitle(null);
您应该添加datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis())然后添加datePickerDialog.setTitle(“”)强>
此类型的序列用于删除顶部白色背景标题也可用于隐藏标题背景
datePickerDialog.setTitle(null);
这太奇怪了。setTitle(“xyz”)在所有其他语句对我有效之后。非常感谢。这只是删除标题吗?如果我需要删除整个白色标题视图,这将删除整个标题。有效的解决方案!
datePickerDialog = new DatePickerDialog(ProfileActivity.this, this, year, month, day);
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
datePickerDialog.setTitle("");
datePickerDialog.show();
datePickerDialog.setTitle(null);