Open 5google5 opened 8 years ago
貌似有缓存,更改日期后,重新打开dialog 显示是上一次日期 怎么解决??
代码如下: List tmp = new ArrayList<>(); if ((null != renterInfo) && (!TextUtils.isEmpty(renterInfo.birthday))) { String[] s = renterInfo.birthday.split("/"); year = Integer.valueOf(s[0]); month = Integer.valueOf(s[1]); day = Integer.valueOf(s[2]); tmp.add(year + "-" + month + "-" + day); } DPCManager.getInstance().setDecorBG(tmp); DatePicker birthday_dp = (DatePicker) view.findViewById(R.id.birthday_dp); birthday_dp.setDate(year, month); birthday_dp.setFestivalDisplay(false); birthday_dp.setTodayDisplay(false); birthday_dp.setHolidayDisplay(false); birthday_dp.setDeferredDisplay(false); birthday_dp.setMode(DPMode.SINGLE); birthday_dp.setDPDecor(new DPDecor() { @Override public void drawDecorBG(Canvas canvas, Rect rect, Paint paint) { paint.setColor(ContextCompat.getColor(MyDataActivity.this, R.color.orange)); canvas.drawCircle(rect.centerX(), rect.centerY(), rect.width() / 2F, paint); } });
大哥,你解决了没有。我也遇到了,日期变了重新打开Dialog就会显示旧的日期
貌似有缓存,更改日期后,重新打开dialog 显示是上一次日期 怎么解决??
代码如下: List tmp = new ArrayList<>();
if ((null != renterInfo) && (!TextUtils.isEmpty(renterInfo.birthday))) {
String[] s = renterInfo.birthday.split("/");
year = Integer.valueOf(s[0]);
month = Integer.valueOf(s[1]);
day = Integer.valueOf(s[2]);
tmp.add(year + "-" + month + "-" + day);
}
DPCManager.getInstance().setDecorBG(tmp);
DatePicker birthday_dp = (DatePicker) view.findViewById(R.id.birthday_dp);
birthday_dp.setDate(year, month);
birthday_dp.setFestivalDisplay(false);
birthday_dp.setTodayDisplay(false);
birthday_dp.setHolidayDisplay(false);
birthday_dp.setDeferredDisplay(false);
birthday_dp.setMode(DPMode.SINGLE);
birthday_dp.setDPDecor(new DPDecor() {
@Override
public void drawDecorBG(Canvas canvas, Rect rect, Paint paint) {
paint.setColor(ContextCompat.getColor(MyDataActivity.this, R.color.orange));
canvas.drawCircle(rect.centerX(), rect.centerY(), rect.width() / 2F, paint);
}
});