开发者

how to set image background of button in Blackberry [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate开发者_Go百科:

Image Button in BlackBerry

i want set images as background of button. but i am not get any idea how it possible so can any one help me for my problem..

Thank you in advance..


You'll need to use a BitmapField, set it FOCUSABLE, and then override navigationClick() to execute the FieldChangeListener


Here's the link to official doc http://docs.blackberry.com/en/developers/deliverables/29251/Creating_a_custom_button_1676236_11.jsp

I think it has everything you need plus it will let you know about creating custom objects


You have to make a custom field that will contain a bitmap and that will handle the click event or use the BitmapField and set the FOCUSABLE style to it. If you need help in how to create custom fields let me know..


It is possible.

    image=Bitmap.getBitmapResource("abc.png");
    one=new ButtonField("One")
    {
        protected void paint(Graphics g) 
        {
            g.drawBitmap(0, 0, image.getWidth(), image.getHeight(), image, 0, 0);
            super.paint(g);
        }
    };
    one.setChangeListener(this);
    hor.add(one);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜