2012-07-27 142 views
1

我是黑莓新手,我正在開發一個黑莓應用程序,在這個應用程序中,我製作了一個登錄屏幕,其中一個白色條形圖像置於頂部,徽標應該出現在該條帶上。所以我簡單地拿兩個horizo​​ntalFieldManager作爲它,並且對於strip而言,它會顯示出好的效果,但是logo會保持在strip的下方。將圖片放在第二張圖片

這裏是我的代碼::

((VerticalFieldManager) getMainManager()).setBackground(BackgroundFactory.createSolidBackground(0xEDEDED)); 

     HorizontalFieldManager hfm = new HorizontalFieldManager(Field.FIELD_VCENTER); 
     HorizontalFieldManager hfm2 = new HorizontalFieldManager(Field.FIELD_VCENTER); 
     Bitmap Topstrip = new Bitmap(Display.getWidth(), Display.getHeight()); 
     Bitmap MoneLogo = new Bitmap(Display.getWidth(), Display.getHeight()); 
     boolean lowRes = Display.getWidth() <= 320; 
     if (lowRes) 
     { 
      // The device has a low resolution screen size 
      Topstrip = Bitmap.getBitmapResource("topstripbg.png"); 
     } 
     else 
     { 
      Topstrip = Bitmap.getBitmapResource("topstripbg-mdpi.png"); 
      MoneLogo= Bitmap.getBitmapResource("logo72X72.png"); 
      // The device has a high resolution screen size 

     } 
     BitmapField TopstripimgField = new BitmapField(Topstrip); 
     BitmapField MoneLogoimgField = new BitmapField(MoneLogo); 

     hfm.add(TopstripimgField); 
     hfm2.add(MoneLogoimgField); 
     add(hfm); 
     add(hfm2); 

我想這樣的:

-------------------------------------- 
____ 
|LOGO|   ** Strip ** 
|____| 
-------------------------------------- 

請還建議我好UI教程最佳實踐

更新:

enter image description here

+0

來到http://chat.stackoverflow.com/rooms/4014/knowledge-sharing-center-for-blackberry-android-iphone-and-java – Signare 2012-07-27 06:53:06

+0

@Signare請參閱 – 2012-07-27 07:03:56

回答

2

試試這個 -

final Bitmap bg=Bitmap.getBitmapResource("background.png"); 
    VerticalFieldManager top = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){ 
     public void paint(Graphics graphics) { 
      graphics.setBackgroundColor(Color.WHITE); 
      graphics.clear(); 
      graphics.drawBitmap(0, 0, bg.getWidth(), 
        bg.getHeight(), bg, 0, 0); 
      super.paint(graphics); 
     } 

    }; 


final Bitmap logo= Bitmap.getBitmapResource("logo.png"); 
top .add(new BitmapField(logo)); 
add(top); 
相關問題