如何绘制listfield行的背景图片?

时间:2011-04-20 14:54:50

标签: blackberry layout listfield

我有一个自定义的ListField,每行都有一个图标和文字。如何将背景图像添加到行中(使用drawListRow()方法)。

1 个答案:

答案 0 :(得分:1)

我认为它应该是这样的:

public void drawListRow(ListField listField, 
        Graphics graphics, int index, int y, int width) {

    Bitmap bg = <here is the code to get your Bitmap for bg>;
    // probably load that bitmap once in ListField constructor 
    // to speed up the drawListRow()

    graphics.drawBitmap(0, y, bg.getWidth(), bg.getHeight(), bg, 0, 0);
}