1
我可以更改当天的突出显示(用红色圈出)。这是当天显示系统,但我的应用程序工作在不同的时区,所以我如何取消突出显示当天或将其更改为另一天。更改日期选择器对话框当前日期 - android java
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);
}
什么是当前良好的应用程序时间? – jeorfevre
这可能有帮助 https://stackoverflow.com/questions/26310750/how-to-set-a-specific-date-in-date-picker-in-android –
好的应用程序时间是第14日 – Mazz