How to set range of Time Picker Dialog in android in kotlin?

给你一囗甜甜゛ 提交于 2019-12-23 05:40:17

问题


I have a function for time picker dialog as follows:

private fun showStartingTimeDialog() {
    val hr = 9
    val mn = 0

    val startingTimeListener = TimePickerDialog.OnTimeSetListener { _, _, _ -> /* no time setting */ }
    TimePickerDialog(this, startingTimeListener, hr, mn, false).show()
}

I want to restrict the selection between 8am and 10am, meaning that the user can only slide the hand of clock between this range, how to do that?

来源:https://stackoverflow.com/questions/56526133/how-to-set-range-of-time-picker-dialog-in-android-in-kotlin

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