【问题标题】:Blackberry Listfield Item SeparatorBlackberry Listfield 项目分隔符
【发布时间】:2012-02-27 14:33:04
【问题描述】:

我想用 graphics.drawLine 方法在 drawListRow 内的 Blackberry Listfield 中添加一个分隔符,但下面的线根本没有被绘制是我正在使用的源代码

drawListRow(ListField listField, Graphics g, int index,int y, int width) 
{
g.setColor(Color.BLACK);
    Font f = g.getFont().derive(Font.BOLD,8,Ui.UNITS_pt);
    g.setFont(f);
    g.drawText (data[0], 10, y, Graphics.LEFT,Display.getWidth()); 
    f = g.getFont().derive(Font.SERIF_STYLE,6,Ui.UNITS_pt);
    g.setColor(0xC4C3C4);//light gray
    int h = f.getHeight() + 5;
    g.setFont(f);
    g.drawText (data[1], 13, y+h, Graphics.LEFT,Display.getWidth());
    g.drawBitmap( (Display.getWidth()- 30), y+7, this.rightIcon.getWidth(), this.rightIcon.getHeight(), this.rightIcon, 0, 0 );
    index = (index==0)?1:index;
    f = g.getFont().derive(Font.PLAIN,6,Ui.UNITS_pt);
    g.setColor(0xC4C3C4);//light gray
    g.drawLine(0, y+DIS_ROW_HEIGHT, Display.getWidth(), y+DIS_ROW_HEIGHT);
}

【问题讨论】:

    标签: blackberry listfield


    【解决方案1】:

    试试

    g.drawLine(0, y+DIS_ROW_HEIGHT-1, Display.getWidth(), y+DIS_ROW_HEIGHT-1);
    

    【讨论】:

    • drawLine thnx 的大 -1 像素
    • 那是行的高度。您可以通过调用 listField.getRowHeight() 来获取它
    • @rfsk2010 这太棒了!但触摸设备(模拟器)9550 或 9930 中没有显示该行。为什么? :(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多