Display an EditField in a ListField of BlackBerry

你离开我真会死。 提交于 2019-12-11 08:07:08

问题


In my app i have to display list of items with price in EditField. How can i add EditField in list?

For ListField, i am using this code

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

    this.listField=listField;
    String text=(String) get(listField, index);
    if(holder[index]==null)
    {
        holder[index]=placeholder;
    }
    graphics.setColor(rgb);
    graphics.setFont(Utility.getBigFont(DConfig.getFSize()+4));
    graphics.drawBitmap(3,y+7,placeholder.getWidth(), placeholder.getHeight(),holder[index], 0, 0);
    graphics.drawText(text,100,y+15);  
    graphics.drawText("Price:",100,y+30);
    graphics.drawText(CartScreen.price[index],100,y+45);
    graphics.drawLine(0, y+74, DConfig.disWidth, y+74);
}

How can i add edit field to list of rows


回答1:


You won't be able to actually place the EditField in there. Your best bet is to use just a VerticalFieldManager and stack LabelFields/EditFields in there. It will still scroll, just won't be ListField.



来源:https://stackoverflow.com/questions/6582178/display-an-editfield-in-a-listfield-of-blackberry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!