我希望在一个alice blue背景的MainScreen上放置几个右对齐文本的LabelFields。不幸的是,我似乎无法弄清楚如何实现这一点。
我所能做的最好的办法就是在MainScreen上设置我的背景为Color.ALICEBLUE,并在屏幕上放置LabelFields(也具有alice blue背景)。
public void paint(Graphics graphics) {
graphics.setBackgroundColor(Color.ALICEBLUE);
graphics.clear();
super.paint(graphics);
}
并且...
LabelField display = new LabelField("", LabelField.FIELD_RIGHT){
public void paint(Graphics graphics) {
graphics.setColor(Color.DIMGRAY);
graphics.setBackgroundColor(Color.ALICEBLUE);
graphics.clear();
super.paint(graphics);
}
};
重写MainScreen的绘制例程可以给我alice blue背景,但是重写LabelFields的绘制例程似乎不够充分。结果是一个白色行,只有标签文本后面的alice blue背景。添加USE_ALL_WIDTH
可以解决背景问题,但我无法使用USE_ALL_WIDTH
进行右对齐。
有人知道解决方法吗?