LWUIT组合框文本颜色问题
问题描述:
组合框的文字颜色是即使我已经将它设置为黑色在我的主题白色。 TextField的文本颜色应该是黑色的。 ComboBox文本颜色怎么不黑?LWUIT组合框文本颜色问题
主题:
fgColor=FFFFFF
bgColor=000000
sel#fgColor=FFFFFF
sel#bgColor=EE8207
ComboBox.fgColor=000000
ComboBox.bgColor=FFFFFF
ComboBox.sel#fgColor=000000
ComboBox.sel#bgColor=FFFFFF
TextField.fgColor=000000
TextField.bgColor=FFFFFF
TextField.sel#fgColor=000000
TextField.sel#bgColor=FFFFFF
答
你可以使用这样的,
ComboBoxItem.fgColor=000000
ComboBoxItem.sel#fgColor=ffffff
是否使用ResourceEdit。如果您不使用手段,请使用ResourceEdit并创建主题。
答
你应该使用hexColors:“0x000000处”或“0XFFFFFF”
您还可以设置使用以下方法在您的应用程序的颜色。
LWUIT方法使用int的设置颜色,来计算INT使用下面的函数。
public static int colorStringToInt(String hexColor) {
int color;
try {
color = Integer.parseInt(hexColor.substring(2), 16);
return color;
} catch (Exception ex) {
ex.printStackTrace();
return -1;//no negative colors
}
}
设置这样的颜色。
int color = AppUtils.colorStringToInt("0xffffff");//white
if (color != -1) {
b.getStyle().setFgColor(color, true);
}
答
你可以改变文本的颜色像这样
Style selStyle = UIManager.getInstance().getComponentSelectedStyle("ComboBoxItem");
selStyle.setFgColor(0x00AF00); // Selected Item will be in green color
UIManager.getInstance().setComponentSelectedStyle("ComboBoxItem", selStyle);
Style unSelStyle = UIManager.getInstance().getComponentStyle("ComboBoxItem");
unSelStyle.setFgColor(0x000000); // Selected Item will be in black color
UIManager.getInstance().setComponentStyle("ComboBoxItem", unSelStyle);
这将制定出!
感谢你的小费,但它不为我工作:S。在LWUIT API中找不到对ComboBoxItem的任何引用。 – AOO 2010-11-24 14:11:48