how to bold a text which is on <strong> tag in blackberry
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 replaced the string <b>
, <br/>
to </n>
. Its fine.
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,"");
精彩评论