时间选择 - timepicker

# 时间选择控件: timepicker ``` <linear orientation="horizontal" marginTop="-5"> <text id="timePickerModeText" text="滑动选择开始时间: " textColor="black" textSize="16sp" marginTop="2" /> <text id="timePickerModeText" text="滑动选择结束时间: " textColor="black" textSize="16sp" marginTop="2" marginLeft="35" /> </linear> <linear orientation="horizontal"> <timepicker timePickerMode="spinner" id="startTime" h="120" w="200" marginLeft="-25" marginTop="-20"></timepicker> <timepicker timePickerMode="spinner" id="endTime" h="120" w="200" marginLeft="-15" marginTop="-20"></timepicker> </linear> ui.startTime.setIs24HourView(true);//设置当前时间控件为24小时制 ui.startTime.setOnTimeChangedListener({ onTimeChanged: function (v, h, m) { //h 获取的值 为24小时格式 let time = h + ":" + m; toastLog("滑动时间当前选择\n" + time); } }); ui.endTime.setIs24HourView(true);//设置当前时间控件为24小时制 ui.endTime.setOnTimeChangedListener({ onTimeChanged: function (v, h, m) { //h 获取的值 为24小时格式 let time = h + ":" + m; toastLog("滑动时间当前选择\n" + time); } }); ```