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); 
     } 
    };