0

在我的应用程序中有一个MainScreen。此屏幕包含大量VerticalHorizontal字段管理器和所有内容成功显示滚动。背景图像滚动禁用黑莓主领域管理器

这是我的主要VerticalFieldmanager的代码。

vfm_Main = new VerticalFieldManager() 
    { 
      public void paint(Graphics g) 
      { 
       g.setColor(Color.WHITE); 
       g.drawBitmap(0,0,mybackgroundImage.getWidth(),mybackgroundImage.getHeight(),mybackgroundImage,0,0); 
            super.paint(g); 
      } 
      protected void sublayout(int maxWidth, int maxHeight) 
      { 
       super.sublayout(Display.getWidth(),Display.getHeight()); 
       setExtent(Display.getWidth(),Display.getHeight()); 
      } 
    }; 

这个屏幕有一个背景图像绘制。当我滚动此屏幕以查看此屏幕的全部内容时,我的背景图片也会随内容一起滚动。因此,背景图片看起来非常模糊,并且在屏幕底部重复。

我想只滚动那个屏幕的内容so所以如何实现这个..?

我已经尝试了很多,但没有得到任何暗示和命中以防止这种情况? 如果有任何人面临这个问题或有任何想法,请帮助我...

在此先感谢!

回答

1

你必须这样做:

vfm_Main = new VerticalFieldManager() 
{ 
      public void paint(Graphics g) 
      { 
       g.setColor(Color.WHITE); 
       g.drawBitmap(0,0,mybackgroundImage.getWidth(),mybackgroundImage.getHeight(),mybackgroundImage,0,0); 
       super.paint(g); 
      } 
      protected void sublayout(int maxWidth, int maxHeight) 
      { 
        super.sublayout(Display.getWidth(),Display.getHeight()); 
        setExtent(Display.getWidth(),Display.getHeight()); 
      } 
}; 

subver=new VerticalFieldManager(VERTICAL_SCROLL|VERTICAL_SCROLLBAR) 
{ 
     protected void sublayout(int maxWidth, int maxHeight) 
     { 
       super.sublayout(Display.getWidth(),Display.getHeight()-3);//here we scroll the inner vertical 
       setExtent(Display.getWidth(),Display.getHeight()-3); 
     } 
} 
//Write all the code here; 
subver.setpadding(1,0,0,0); 
vfm_main.add(subver); 
add(vfm_Main); 

这样的形象:

Vertical Scrolling

不够;

+0

thanx @alishaik ..我已经实现了这种方式...但它仍然滚动backround图像...你有没有成功实施这个? – Hitarth

+0

我的确如此。 而且我运行成功。编码器。 – alishaik786

0

我也曾经遇到同样的问题。我通过使用2个这样的现场经理来解决它。

VerticalFieldManager mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR) 
    { 

     public void paint(Graphics graphics) 
     { 
      graphics.clear(); 
      graphics.drawBitmap(0, 0, Display.getWidth(), Display.getHeight(), backgroundBitmap, 0, 0);      
      super.paint(graphics); 
     }    
    }; 
    //this manager is used for adding the componentes 
    VerticalFieldManager subManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR) 
    { 
     protected void sublayout(int maxWidth, int maxHeight) 
     { 
      int displayWidth = Display.getWidth(); 
      int displayHeight = Display.getHeight(); 

      super.sublayout(displayWidth, displayHeight); 
      setExtent(displayWidth, displayHeight); 
     } 
    };