开发者

change font size in browser field blackberry

开发者 https://www.devze.com 2022-12-29 00:12 出处:网络
here is the code: public class MyHttp extends MainScreen{ public static final String HTTP_FILE = \"local:///sources\";

here is the code:


public class MyHttp extends MainScreen{
   public static final String HTTP_FILE = "local:///sources";
   public MyHttp(String fileName){
       BrowserField browserField = new BrowserField();
       add(browserField);
       try{ 
           browserField.requestContent(HTTP_FILE + fileName);
       } catch (Exception ex) {
           ex.pr开发者_开发知识库intStackTrace();
       }
   }
}

how can I change the font size in this browserField?

Any ideas? Thanks in advance.


If you have the file locally, you can add CSS styles to set the font size accordingly.

If you are using the 6.0 SDK, you MUST set the viewport tag or the font size will be ignored:

<head>
   <meta name='viewport' content='width=device-width,height=device-height,initial-scale=1.0'>
   <style> (Your CSS styles) </style>
</head>


As the BrowserField is an extension of type Field, it inherits the setFont method:

browserField.setFont(myFont);

I don't have 5.0 running on my local box so I couldn't test it but according to the API it should work.

Hope this helps

0

精彩评论

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