LWUIT ComboBox 文本颜色问题

发布于 2024-10-04 08:29:33 字数 420 浏览 0 评论 0原文

尽管我在主题中将其设置为黑色,但组合框文本颜色为白色。 TextField 的文本颜色应该是黑色。为什么 ComboBox 文本颜色不是黑色?

主题:

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  

The ComboBox text color is white even though I've set it to black in my theme. The text color of TextField is black as supposed to. How come the ComboBox text color isn't black?

The theme:

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  

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

萌吟 2024-10-11 08:29:33

您可以像这样更改文本颜色

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);

这会成功!

You can change the text color like this

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);

This will work out!!

下壹個目標 2024-10-11 08:29:33

您应该使用 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);
}

You should use hexColors: "0x000000" or "0xffffff"

You can also set the color in your app using following methods.

lwuit uses int's to set a color, to calculate the int use the following function.

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
    }
}

set the color like this.

int color = AppUtils.colorStringToInt("0xffffff");//white
if (color != -1) {
    b.getStyle().setFgColor(color, true);
}
半衾梦 2024-10-11 08:29:33

你可以这样使用,

ComboBoxItem.fgColor=000000  

ComboBoxItem.sel#fgColor=ffffff

你是否使用ResourceEdit。如果您不使用意味着使用资源编辑并创建主题。

you can use like this,

ComboBoxItem.fgColor=000000  

ComboBoxItem.sel#fgColor=ffffff

Are you using ResourceEdit. If u r not using means use the ResourceEdit and create the theme.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文