我在我的應用程序中創建了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