How to customize listfield in blackberry?
I开发者_StackOverflow am currently working on list fields. In my list, each row contains title, subtitle and image. I need a list of rows as output. Each row should contain two labelfiels and one bitmap.
Can any tell me a way to do it?
You should implement ListFieldCallback for your ListField. Then you will be able to add images and text to each row at your chosen positions within the ListFieldCallback method drawListRow.
To add an image use graphics.drawBitmap. (graphics is a parameter of drawListRow)
drawBitmap(int x, int y, int width, int height, Bitmap bitmap, int left, int top)
x is the number of pixels from the left of this row your bitmap will be placed. Y is the number of pixels from the top of this row. So you can use y+10 to get an image to have 10 pixels spacing from the top of the row.
And graphics.drawText which similarly allows you to place your text at positions relative to the left and top of the row.
How to implement ListFieldCallback
精彩评论