我需要在Blackberry上创建一个带圆角边框的textboxField。 我尝试制作一个自定义文本框但似乎不太好。 任何人都可以在Blackberry上为我分享一个好的自定义TextBoxField课程吗?
答案 0 :(得分:6)
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_);
答案 1 :(得分:0)
在上面的代码中应该在评论的背景图片中写入“img.bmp”,因为它会出错 final Bitmap header_Bitmap =“img.bmp”; //背景图片;
VerticalFieldManager vfm_ = new VerticalFieldManager(
Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR
| Manager.NO_VERTICAL_SCROLL
| Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH)