Search This Blog

Thursday, 24 May 2012

How to Apply Border and background for any Field or Manager in Blackberry

Hello friends,
                     Got struck with those sharp edged boring EditFields ,and dull looks? Try giving some background and border to your Layouts and Fields....Follow the code Below...


For Declaring a Border :

XYEdges _padding = new XYEdges(3,3,3,3);
        int _color =0x004E78A0;
        int _lineStyle = Border.STYLE_FILLED;
        Border _border = BorderFactory.createRoundedBorder(_padding, _color, _lineStyle);  

//try Different values for _lineStyle and _color ,_padding gives the thickness of the border...

For Background (Bitmap):
Background _toolbarBack = BackgroundFactory.createBitmapBackground(<Bitmap>);

For Background(Gradient Color):

Background _layoutBack = BackgroundFactory.createLinearGradientBackground(int colorTopLeft, int colorTopRight, int colorBottomRight, int colorBottomLeft);

How to apply Border and Background to a Field or Manager :

Suppose we have a EditField with an object name _text;

so here it is how we apply border and background to this field:


Apply border and background to Managers in same way....


No comments:

Post a Comment