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);
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.
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.
in my screen , i want to create/add button with an icon and under this icon i want to write the title of this button
like this picture
Create a custom Field.
For instance, here is an idea of what to do. Your bitmap could alreay contain a label, or to have a String label freely "assignable" to this button you can extend that example (by adding the code to draw the label in paint(Graphics graphics), check the API of Graphics - it is possible to write a text on it).
Can anybody help me on this?
I tried to override onFocus(), onUnfocus() and paint() methods of ListField.
Please do a simple web search before post to stackoverflow.
Please go through the following links.
Create a Custom Listfield - Change Highlight Color when Scrolling by John Banks
Blackberry Tip: Change the default focus highlight color of ListField by Yincan Sheng
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