我有两个图像的对话框,我正在其中一个imageview上实现timepicker,如下所示:
ImageView setTime = (ImageView) dialog.findViewById(R.id.autodelete);
//setTime.setVisibility(View.GONE);
setTime.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// final Calendar c = Calendar.getInstance();
// int hour = c.get(Calendar.HOUR_OF_DAY);
// int minute = c.get(Calendar.MINUTE);
//TimePickerDialog tp1 = new TimePickerDialog(getApplicationContext(), mTimeSetListener, hour, minute,false);
// tp1.show();
showDialog(TIME_DIALOG_ID);
}
});
private TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
pHour = hourOfDay;
pMinute = minute;
//updateDisplay();
// displayToast();
}
};
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case TIME_DIALOG_ID:
return new TimePickerDialog(this, mTimeSetListener, pHour, pMinute, false);
}
return null;
}
但是当我点击图片时,我发现onclick
没有触发。不知道发生了什么。