//弹出时间对话框
button = findViewById(R.id.select);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//获取日历实例(里面包括的当前分秒)
Calendar calendar = Calendar.getInstance();
new TimePickerDialog(TimePickerActivity.this,android.R.style.Theme_Holo_Light_Dialog/*设置为下滑选项框*/, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker timePicker, int i, int i1) {
String desc = String.format("你选择的时间是%d时、%d分:" , i , i1);
textView.setText(desc);
}
},calendar.get(Calendar.HOUR_OF_DAY),calendar.get(Calendar.MONDAY),true/* 设置为24小时制*/).show();
}
});
标签:对话框,int,时间,Override,new,Calendar,calendar
From: https://www.cnblogs.com/loulan/p/16975845.html