codenameone : 自定义日历按钮背景
codenameone : Custom calendar button background
我需要根据日期按钮的内容创建一个具有不同背景颜色的日历,我怎样才能使颜色固定:使用 codenameone 选择另一个日期时不变。
i tried a simple modification but when selecting a button the colors turn back to white as configured in the theme (i use UI builder)
@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);
我需要根据日期按钮的内容创建一个具有不同背景颜色的日历,我怎样才能使颜色固定:使用 codenameone 选择另一个日期时不变。
i tried a simple modification but when selecting a button the colors turn back to white as configured in the theme (i use UI builder)
@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);