1

我开发了简单的代码来在黑莓屏幕上显示图像和标题,但我无法显示任何内容(但如果我只测试标题,它就可以工作)。

我的要求是在列表中显示带有标题的图像。

我已按照此链接从图像 url 获取图像

这里是我在 drawlistrow 方法中的代码:

public void drawListRow(ListField list, Graphics g, int index, int y, int w) 
        {
            String text = (String)listElements.elementAt(index);
            Bitmap image =GetImage.connectServerForImage("http://toucheradio.com/toneradio/iphone/toriLite/toriLive.png");
            g.drawLine(0, y, w, y);

            g.drawText(text, 150, y, 60, w);
            g.drawBitmap(0,y,image.getWidth(),image.getHeight(),image,0,0);
        }

可能是什么问题呢?

4

1 回答 1

3

请检查图像的高度和宽度,如果它比你的屏幕分辨率大,那么你必须裁剪或放大你得到的图像。给drawBitmapMethod一些x轴我刚刚给你的想法如下你可以实现。

g.drawBitmap(340, y, image.getWidth(), image.getHeight(), image, 0, 0);
于 2012-09-14T10:29:08.253 回答