Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry 设置十六进制颜色代码“#埃德德;作为我的黑莓主屏幕的背景色?_Blackberry_Background Color - Fatal编程技术网

Blackberry 设置十六进制颜色代码“#埃德德;作为我的黑莓主屏幕的背景色?

Blackberry 设置十六进制颜色代码“#埃德德;作为我的黑莓主屏幕的背景色?,blackberry,background-color,Blackberry,Background Color,我正在做一个UI任务,在这个任务中,我需要设置背景色,背景色以十六进制代码“#eded”给出。现在我正在使用以下代码: ((VerticalFieldManager) getMainManager()).setBackground(BackgroundFactory.createSolidBackground(**Color.LIGHTGRAY**)); 但是我必须使用“#ededed”十六进制颜色代码来代替这个Color.LIGHTGRAY 请帮我完成这个小但合乎逻辑的任务。 提前结束 为什

我正在做一个UI任务,在这个任务中,我需要设置背景色,背景色以十六进制代码“#eded”给出。现在我正在使用以下代码:

((VerticalFieldManager) getMainManager()).setBackground(BackgroundFactory.createSolidBackground(**Color.LIGHTGRAY**));
但是我必须使用“#ededed”十六进制颜色代码来代替这个Color.LIGHTGRAY

请帮我完成这个小但合乎逻辑的任务。
提前结束

为什么不使用此链接将颜色转换为所需颜色并在代码中实现

            http://easycalculation.com/color-coder.php
如果您打算使用java颜色代码,这是最好的链接

            http://www.jafar.com/java/csel/index.html

希望有帮助。

为什么不使用此链接将颜色转换为所需的颜色并在代码中实现

            http://easycalculation.com/color-coder.php
如果您打算使用java颜色代码,这是最好的链接

            http://www.jafar.com/java/csel/index.html
希望有帮助。

怎么样:

((VerticalFieldManager) getMainManager()).setBackground(BackgroundFactory.createSolidBackground(0xededed));
那么:

((VerticalFieldManager) getMainManager()).setBackground(BackgroundFactory.createSolidBackground(0xededed));

下面的代码将字符串(十六进制表示)转换为其等效整数,并使用该值作为背景色

String strColor=“#eded”;
//删除#字符
strColor=strColor.substring(1);
试一试{
//获取整数等价项
inticolor=Integer.parseInt(strColor,16);
getMainManager().setBackground(BackgroundFactory.createSolidBackground(iColor));
}捕获(例外exc){
}

以下代码将字符串(十六进制表示)转换为其等效整数,并使用该值作为背景色

String strColor=“#eded”;
//删除#字符
strColor=strColor.substring(1);
试一试{
//获取整数等价项
inticolor=Integer.parseInt(strColor,16);
getMainManager().setBackground(BackgroundFactory.createSolidBackground(iColor));
}捕获(例外exc){
}
最简单的解决方案是:

getMainManager().setBackground(BackgroundFactory.createSolidBackground(0xededed));
无需强制转换为
垂直字段管理器
,因为主管理器是
字段
,该类包含
设置背景
方法。

最简单的解决方案是:

getMainManager().setBackground(BackgroundFactory.createSolidBackground(0xededed));

无需强制转换为
垂直字段管理器
,因为主管理器是
字段
,该类包含
setBackground
方法。

我认为字符串“#eded”需要在运行时转换为其等效整数。无需在运行时执行此操作,编译器将“0x”识别为十六进制前缀,并将以下字符解释为整数的十六进制表示。太好了,它起作用了。Thanxx alot Eugen Martynov和stack社区:@MichaelDonohue,我认为颜色代码“#ededed”是一个字符串对象。我认为字符串“#ededed”需要在运行时转换为其等效整数。无需在运行时进行转换,编译器将“0x”识别为十六进制前缀,并将以下字符解释为整数的十六进制表示。太好了,它起作用了。Thanxx alot Eugen Martynov和stack社区:@MichaelDonohue,我认为颜色代码“#eded”是一个字符串对象。