Aadi Narayana
Aadi Narayana

Reputation: 9

how to set background for blackberry

i have used the following to set a background for blackberry ..no errors but in the output when i scroll down the image gets repeated .. how to solve this problem .please help me

  public final class MyScreen extends MainScreen
    {
      Bitmap background;
    public MyScreen()
    {  

     background = Bitmap.getBitmapResource("CVMS.jpg");
         VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH |  
            VerticalFieldManager.NO_VERTICAL_SCROLL);
            vfm.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("CVMS.jpg"),Background.POSITION_X_LEFT,Background.POSITION_Y_TOP,Background.REPEAT_INHERIT));  


          add(vfm);

              }
   }
  this is my complete code 

Upvotes: 0

Views: 496

Answers (2)

rosco
rosco

Reputation: 939

Have you tried using Background.REPEAT_NONE ?

Upvotes: 1

tipycalFlow
tipycalFlow

Reputation: 7644

All you need to do is change a flag in the following line

vfm.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("CVMS.jpg"),Background.POSITION_X_LEFT, Background.POSITION_Y_TOP, Background.REPEAT_SCALE_TO_FIT));

You just need to use REPEAT_SCALE_TO_FIT instead of REPEAT_INHERIT

Upvotes: 3

Related Questions