开发者

how to bold a text which is on <strong> tag in blackberry

开发者 https://www.devze.com 2023-04-11 08:04 出处:网络
I\'ve got HTML string returned from a Web Service. Sample string would be: I want to display the HTML string in the label field.

I've got HTML string returned from a Web Service. Sample string would be:

how to bold a text which is on <strong> tag in blackberry

I want to display the HTML string in the label field.

I've replaced the string <b>, <br/> to </n>. Its fine.

开发者_StackOverflow

I want to set bold the string which is on <strong>, </strong>.


IF you want to make all the text bold, just use:

yourLabelField.setFont(getFont().derive(Font.BOLD, getFont().getHeight()));

If you want only a part of the text, you will have to use RichTextField:

http://www.blackberry.com/developers/docs/3.7api/net/rim/device/api/ui/component/RichTextField.html


in many tags are not working in label field so if you want to display according to HTML tags you need to use Browser Field like

String str="<html><head><style type=\"text/css\">a {color:OLIVE;}</style></head><body style=background-image:url('local:///background.png');background-repeat:no-repeat; width:100%;height:100%;> <font size=3 color=olive><b>About Us</b></font> <font size=2>"what the string do you want to show hear you can paste"</body></html>";
    browser_field.displayContent(str,"");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号