Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry 如何使用ListField类显示文本行?_Blackberry - Fatal编程技术网

Blackberry 如何使用ListField类显示文本行?

Blackberry 如何使用ListField类显示文本行?,blackberry,Blackberry,请帮我到上述热带地区 该行应包含 row1 text text img text text row2 text text img text text 每一排都应该是这样。实际上,它将以行的形式显示多个提取的JSON数据。只需调用list.setRowHeight(),给自己足够的空间来显示所有这些数据,然后在ListFieldCallback的drawListRow()方法中,按照自己的喜

请帮我到上述热带地区 该行应包含

  row1      text    text  img
            text    text

  row2      text    text img
            text    text 

每一排都应该是这样。实际上,它将以行的形式显示多个提取的JSON数据。

只需调用
list.setRowHeight()
,给自己足够的空间来显示所有这些数据,然后在ListFieldCallback的
drawListRow()
方法中,按照自己的喜好绘制每个字段。如果你需要进一步的解释,请发表评论,我可以展开

编辑评论: 您可以在drawListRow()中执行类似的操作


Thanx的可能副本…请给出代码。实际上,该文本是通过解析JSON字符串获得的数据。我已经在一个向量中收集了JSON字符串,我不知道如何在ListField中显示这个字段。是的,上面的代码可以工作,但是现在出现了一个问题。如果我需要在一行中垂直显示三个文本,则第三个文本不会显示,现在我需要增加单个行的高度。如何重写此ListField类?请给出整个代码。你不能改变每行的高度,但我已经看到行的高度可以增加。如果有人可以,请提供帮助…您可以使用
list.setRowHeight()
设置所有行的高度,如我在回答中所述。
public void drawListRow(Graphics graphics, int index, int y, int width) {
    //get your strings from the vector, I'm calling them t1 and t2 and the image img

    //draw the top line of text
    graphics.drawText(t1, 0, y);
    //draw the second line of text
    graphics.drawText(t1, 0, y + getFont().getHeight()); //You can cache the font height for performance if you want

    //draw the bitmap
    graphics.drawText(width - img.getWidth(), y, img, 0, 0);
}