我想在具有愛麗絲藍色背景的MainScreen上放置幾個帶有右對齊文本的LabelField。不幸的是我似乎無法弄清楚如何做到這一點。Blackberry - 設置LabelField背景顏色
我可以做的最好的事情是在MainScreen上將我的背景設置爲Color.ALICEBLUE,並將LabelFields放置在屏幕上(也帶有愛麗絲藍色背景)。
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油漆例行給我我愛麗絲藍色的背景,但重寫LabelFields'油漆程序似乎並不足夠。結果是一個白色的行,僅在標籤文本後面有一個愛麗絲藍色背景。添加USE_ALL_WIDTH
可以糾正背景問題,但我不能正確對齊USE_ALL_WIDTH
。
有沒有人知道這方面的工作?
也很好用!此外,這種方法使我無需爲每個添加的LableField重寫paint方法。 – 2009-08-11 23:40:45