我需要根据日按钮的内容创建一个具有不同背景颜色的日历,如何使颜色修复:使用代号选择另一个日期时保持不变。
我尝试了一个简单的修改,但是当选择一个按钮时,颜色会按照主题中的配置变回白色(我使用 UI 构建器)
@Override
protected void updateButtonDayDate(Button dayButton, int year, int currentMonth, int day) {
//dayButton.setUIID("Container");
dayButton.getAllStyles().setPaddingTop(3);
dayButton.getAllStyles().setPaddingBottom(3);
dayButton.getAllStyles().setBgColor(ColorUtil.BLUE);
}
尝试设置setChangesSelectedDateEnabled(false)
并通过执行以下操作来确保按钮没有边框并且它是不透明的:
Style s = dayButton.getAllStyles();
s.setPaddingTop(3);
s.setPaddingBottom(3);
s.setBgColor(ColorUtil.BLUE);
s.setBgTransparency(255);
s.setBorder(null);