问题
I need make a textboxField on Blackberry with rounded border. I try make a custom textbox but it seem not good. Can anybody share me a class for good custom TextBoxField on Blackberry ?
回答1:
final Bitmap header_Bitmap = //background image;
VerticalFieldManager vfm_ = new VerticalFieldManager(
Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR
| Manager.NO_VERTICAL_SCROLL
| Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH) {
public void paint(Graphics graphics) {
graphics.setBackgroundColor(0x040811);
graphics.clear();
graphics.drawBitmap(0, 0, header_Bitmap.getWidth(),
header_Bitmap.getHeight(), header_Bitmap, 0, 0);
super.paint(graphics);
}
};

Bitmap borderBitmap = //the rounded image;
VerticalFieldManager vfm_email = new VerticalFieldManager();
vfm_email.setBorder(BorderFactory.createBitmapBorder(new XYEdges(5, 5,
5, 5), borderBitmap));
EmailAddressEditField email = new EmailAddressEditField("Email : ", "", 50, Field.FOCUSABLE);
vfm_email.add(email);
vfm_.add(vfm_email);
add(vfm_);
回答2:
In the above code what should be written in the commented background image,"img.bmp" as it gives an error final Bitmap header_Bitmap = "img.bmp" ;//background image;
VerticalFieldManager vfm_ = new VerticalFieldManager(
Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR
| Manager.NO_VERTICAL_SCROLL
| Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH)
来源:https://stackoverflow.com/questions/9226600/how-to-make-a-custom-textboxfield-with-rounded-border-on-blackberry