I want to display the contacts in a TreeField like:
An image followed by a username
My understanding is that I use a BitmapField to display the image, but I don't see how to combine a BitmapField with a TreeField.
You can't use another field with a TreeField. You need to implement the TreeFieldCallback.drawTreeItem() method and do the drawing yourself
See my answer to a similar StackOverflow question: "Customising Blackberry Treefield."
In that answer, I've re-drawn each row of a TreeField along with a Bitmap image replacing the default (+)-icon of TreeField.
You can do it by using graphics.drawBitmap() method and graphics.drawText() method and using the index and y parameters inside the drawTreeItem() method of class which implements TreeFieldCallback interface
Related
Is it possible to change background of active item in menu? (It's SDK6)
Like in picture:
And how I can get rid of this (last repeat of background):
It seems to me that Menu, as an object, is just a customized popupscreen. Maybe extend popupscreen and draw the focus however you'd like it. Submenus will get trickier.
I want to make one search bar on top of the mainscreen and this search bar should include one editfield and one image of search icon.
Please help me...
Thanks, in advance
You need to use an HorizontalFieldManager to put editfield and image on the same line. Read here http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/ui/container/HorizontalFieldManager.html and here: http://www.androidadb.com/class/ho/HorizontalFieldManager.html , a simple example showing how adding two buttons in an HorizontalFieldManager. Just substitute buttons with yor needed fields.
Or you can play with GridFieldMgr:
GridFieldManager gridMgr_g = new GridFieldManager(1, 2, 0);
gridMgr_g.setColumnProperty(0, GridFieldManager.FIXED_SIZE, screenWidth-myBitmapRes.width);
gridMgr_g.setColumnProperty(1, GridFieldManager.FIXED_SIZE, myBitmapRes.width);
gridMgr_g.add(new EditField());
gridMgr_g.add(new BitmapField(Bitmap.getBitmapResource(myBitmapRes)));
add(gridMgr_g);
how could i create a custom ButtonField with no border in Blackberry...
any help will be appreciated
bingo, just add the applyTheme() method
class BitmapButtonField extends ButtonField {
protected void applyTheme()
{
}
}
Arhimed & Rafael, thanks for you help!
Use this tutorial to create your own custom field.
Control the appearance of your field in paint() method.
Yes, this is possible by extending Field. You just need to create 2 images (one for a focused state and one for an unfocused state). Just don't draw the border on those images.
A sample implementation can be found here.
As Arhimed said, you should extend Field. This will give you the maximum amount of customization over how the button looks.
Here's an example of a customizable button I've created: https://github.com/HeshamMegid/BlackBerry-Custom-Controls
You could use it as it is or modify the code further to suit your needs.
How can i create iphone like tabs layout in a blackberry java application for all types of blackberry devices(scrollpad/touch screen). Are there any alternatives to achieve that effect? could you please suggest me in that way?
thanks,
venu
Hi
I had to create tabs in blackberry so for this this i tried a custom way which fulfilled my requirement.May be u can use and customize this idea.
1) create a method addTab() in a class and place say 5 bitmap fields(components) in that.
2) place these components in an horizontal field manager
3) addTab() method must return this manager.
4) create a method result() in that class that must be called whenever the components(Bitmap fields) are clicked.
Now in your main class wherever you want to display the tabs:
1) create object for that class and do
add(obj.addTab());
or u can do :
setStatus(obj.addTab());
depending upon your requirement
I need to create a custom gauge field which looks slimmer like a Blue thin line filling in.
Any ideas/resources?
There aren't any native BlackBerry controls, but you can create your own custom field and implement a paint() method that draws the gauge using Graphics.fillRoundRect().