Remove title from DatePickerDialog in Android

给你一囗甜甜゛ 提交于 2019-12-23 18:39:54

问题


I want to restrict a DatePickerDialog to a minimum value of tomorrow. When I put the code that I show below, the restriction works. However, title text containing the date appears like a header. How can I fix this?

This is my code:

 Calendar tempDate = Calendar.getInstance();
 tempDate.add(Calendar.DAY_OF_MONTH, 1);
 toDatePickerDialog.getDatePicker().setMinDate(tempDate.getTimeInMillis());

and the image:


回答1:


You can either manually set the title to an empty string, or you can request the dialog to have no title.

Former approach:

toDatePickerDialog.setTitle("");

Latter approach:

toDatePickerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

Make sure to do either of these before you call toDatePickerDialog.show()




回答2:


you could fix that easily through the theme with windowNoTitle set to true.



来源:https://stackoverflow.com/questions/41388016/remove-title-from-datepickerdialog-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!