1、
implementation 'com.contrarywind:Android-PickerView:4.0.1'
2、用法
fun showDatePickerDialog(text: TextView) {
//时间选择器
TimePickerBuilder(this, OnTimeSelectListener { date, v ->
val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
text.setText(format.format(date))
}).setType(booleanArrayOf(true, true, true, false, false, false))
.setOutSideCancelable(true)
.setSubmitColor(ContextCompat.getColor(this, R.color.system))
.setCancelColor(ContextCompat.getColor(this, R.color.system))
.build()
.show()
}
setType中的值分别表示 年月日时分秒是否可选
3、效果图如下