我在我的应用程序中创建了custom menu
,我已经在菜单中设置了其项目显示的background,border and font
。但是我无法为菜单中的菜单项显示设置font color
。
如何设置字体颜色为菜单项?? ..
我的代码看起来是这样的:
我已经设置边框,背景和字体,如下图所示: -黑莓中的自定义菜单 - 更改菜单项的字体颜色
XYEdges edge = new XYEdges(10, 10, 10, 10);
menu_border = BorderFactory.createRoundedBorder(edge,Border.STYLE_DOTTED);
menu_back = BackgroundFactory.createSolidTransparentBackground(Color.LIGHTPINK,50);
try
{
FontFamily fnt_family = FontFamily.forName("BBCasual");
menu_font = fnt_family.getFont(Font.PLAIN,30,Ui.UNITS_px);
}
catch(ClassNotFoundException e){
}
和我重写列出MakeMenu如图所示()函数:
protected void makeMenu(Menu menu,int context)
{
menu.setBackground(menu_back);
menu.setBorder(menu_border);
menu.setFont(menu_font);
super.makeMenu(menu, context);
}
在此先感谢..
是否有任何其他方式做到这一点? – 2012-03-16 11:34:25
我不这么认为。 – 2012-03-16 12:24:05