【发布时间】:2017-06-13 13:25:45
【问题描述】:
我可以更改一天的突出显示(红色圆圈)。这是显示系统当前日期,但我的应用程序在不同的时区工作,所以我怎样才能取消突出显示这一天或将其更改为另一天。
private void setDateTimeField() {
billDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
billDateDialog.show();
billDateDialog.updateDate(billDateCal.get(Calendar.YEAR), billDateCal.get(Calendar.MONTH), billDateCal.get(Calendar.DAY_OF_MONTH));
}
});
billDateDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// Bills need to be set to 00.00 hours. DST needs to be ignored because changing to other timezones with no DST will cause problems with days changing to the day before.
long correctedTime = new DayLightSavings(year, monthOfYear, dayOfMonth, timeZone).getCorrectedTime();
billDateCal.setTimeInMillis(correctedTime);
billDate.setText(dateFormatter.format(billDateCal.getTimeInMillis()));
}
},billDateCal.get(Calendar.YEAR), billDateCal.get(Calendar.MONTH), billDateCal.get(Calendar.DAY_OF_MONTH));
// Do not allow selection of <= today's date.
// TODO Dialogue needs to be based on timezone selection.
long oneDay = TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
long oldRawOffset = TimeZone.getDefault().getRawOffset();
long newRawOffset = timeZone.getRawOffset();
long rawOffset = oldRawOffset - newRawOffset;
// TODO fix dialogue to display the correct timezone current day.
billDateDialog.getDatePicker().setMinDate(Calendar.getInstance().getTimeInMillis() + oneDay - rawOffset);
}
【问题讨论】:
-
当前的好应用时间是多少?
-
好app时间是14号
-
@Mazz 对此有何解决方案?
-
不,很遗憾没有
标签: java android datepickerdialog