开发者

How to create a ListField with 2 textfield and 1 icon on each row?

I am new on Blackberry app. development. Can you suggest some documentations a开发者_如何学JAVAbout custom ListField?


You can achive this easily with out using a custom list field. You just use "drawListRow" method class ListCallback implements ListFieldCallback.

eg:

private class ListCallback implements ListFieldCallback{
        public void drawListRow(ListField list, Graphics g, int index, int y,int w) {

 g.drawBitmap(0, y, mp3Bitmap.getWidth(), 50, mp3Bitmap, 0, 0);
 g.drawText(mediaTypeString,40, y, 0, w);    
 g.drawText(bitrate+" kbps", 40, y+20, 130, w);

}

This will create each row of ListFiled with one image and two row of text.


One does not normally add UI objects to a list since if the list has many items the overhead would quickly consume available resources. The application is responsible for rendering the list times in a ListFieldCallback. So just set the ListField.setRowHight() to give you the room you need, then render the text and icon as you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜