How to set minimum DatePicker date to current date

前端 未结 9 1749
有刺的猬
有刺的猬 2020-11-28 07:30

I want to set the minimum date the user can choose in a DatePicker to the current date. I\'ve tried this:

DatePicker datePicker = (DatePicker) findViewById(R         


        
9条回答
  •  被撕碎了的回忆
    2020-11-28 08:08

    If you don't want to use a custom dialog. Use this single line code:

    datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis()); 
    

提交回复
热议问题