问题描述
我不知道如何字体风格在黑莓
适用于文本在的LabelField
。
I don't know how to apply font style to a text in a LabelField
in Blackberry
.
推荐答案
下面是它具有延伸labelField和展示如何设置字体的ResponseLabelField一个帖子:
<一href=\"http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=37988\">http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=37988
Here's a post which has a ResponseLabelField that extends LabelField and shows how to set the font:http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=37988
下面是给你一个快速code片断:
Here's a quick code snippet for you:
LabelField displayLabel = new LabelField("Test", LabelField.FOCUSABLE)
{
protected void paintBackground(net.rim.device.api.ui.Graphics g)
{
g.clear();
g.getColor();
g.setColor(Color.CYAN);
g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
g.setColor(Color.BLUE);
}
};
FontFamily fontFamily[] = FontFamily.getFontFamilies();
Font font = fontFamily[1].getFont(FontFamily.CBTF_FONT, 8);
displayLabel.setFont(font);
有人纠正我,如果我错了,但我相信不同的字体是通过使用不同的索引到 fontFamily中
阵列选择。
编辑:这里是你可以使用的字体之间切换的测试程序:http://blackberry-digger.blogspot.com/2009/04/how-to-change-fonts-in-blackberry.html
And here's a test app you can use to switch between fonts: http://blackberry-digger.blogspot.com/2009/04/how-to-change-fonts-in-blackberry.html
这篇关于如何设置在黑莓的字体文字的LabelField?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!