LWUIT HtmlComponent [英] LWUIT HtmlComponent

查看:48
本文介绍了LWUIT HtmlComponent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML字符串:

I've an Html String:

String html="<p><img border=\"1\" align=\"left\" width=\"150\" vspace=\"2\" hspace=\"2\" height=\"159\" src=/"tmdbuserfiles/ntr-vv-vinayak-pics.jpg\" alt=\"Prithvi II, ballistic missile, DRDO, armed forces,Chandipur, Balasore district, Odisha State\" />The Strategic Forces Command of the armed forces successfully flight-tested the surface-to-surface Prithvi II missile from Chandipur in Balasore </P>";

我想在LWUIT表单屏幕上显示文本和图像,根据我的要求,我使用了以下代码:

I want to display the text as well as Image on my LWUIT Form Screen,For my Requirement I've used the below code:

public class LwuitMidlet extends MIDlet {

    public void startApp() {
        Display.init(this);
Form f = new Form("Hello, LWUIT!");
String html="<p><img border=\"1\" align=\"left\" width=\"150\" vspace=\"2\" hspace=\"2\" height=\"159\" src=www.teluguone.com/tmdbuserfiles/ntr-vv-vinayak-pics.jpg\" alt=\"Prithvi II, ballistic missile, DRDO, armed forces,Chandipur, Balasore district, Odisha State\" />The Strategic Forces Command of the armed forces successfully flight-tested the surface-to-surface Prithvi II missile from Chandipur in Balasore </P>";

    HTMLComponent com=new HTMLComponent();
       com.setPreferredSize(new Dimension(300,300));

       com.setHTML(html, null, null, false);
       com.setShowImages(true);

       //com.setHTML(image, null, null, false);

      f.addComponent(com);

      f.show();
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}

如果我使用上面的代码,我只能显示文本,但是我不能显示图像,我已经测试了我的SDK 2.O和SDK 3.0.5上的应用程序

If i use the above code,I'm able to display only the text,but i'm not able to display the image,I've tested my app on Nokia SDK 2.O and SDK 3.0.5

有人可以帮助我吗?

推荐答案

您需要具有完整的HTML代码,而不仅仅是片段. HTML,正文等.

You need to have the full HTML code not just a snippet. The HTML, body etc.

这篇关于LWUIT HtmlComponent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆