设置一年日历的最小日期时,日历标题中显示隐藏的日期

问题描述

我将最低日期设置为DatePicker#setMinDate),尽管未显示minDate之前的日期,但是存在一个错误,如果我将年份更改为过去的年份(与当前日期相同的日期)天),然后按确定,选择的日期是我输入的minDate之前的日期。

这是我使用的代码

private fun customCalender() {
        val cal = Calendar.getInstance()
        val cal1 = Calendar.getInstance()
        val dialog = DatePickerDialog(this@MainActivity,{ arg0,arg1,arg2,arg3 ->
            Toast.makeText(this@MainActivity,"" + arg1 + "/" + (arg2 + 1) + "/" + arg3,Toast.LENGTH_SHORT).show()
        },cal.get(Calendar.YEAR),cal.get(Calendar.MONTH),cal.get(Calendar.DAY_OF_MONTH))
        cal1.add(Calendar.YEAR,-1)
        dialog.datePicker.minDate = cal1.timeInMillis
        dialog.datePicker.maxDate = System.currentTimeMillis()
        dialog.show()
    }

请参考屏幕快照以获取参考, While i am selecting a date a day before the maximum date i.e i am selecting 2020 Mon,sept 28 as it showing in header

After switching to previous date without changeing any thing,In the header its showing 2019 sat,sept 28 which was in hidden date in calendar

我已经找到了解决方案,但尚未解决, 请帮我 , 谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)