2012-02-10 50 views

回答

6
final Bitmap header_Bitmap = //background image; 
    VerticalFieldManager vfm_ = new VerticalFieldManager(
      Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR 
        | Manager.NO_VERTICAL_SCROLL 
        | Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH) { 
     public void paint(Graphics graphics) { 
      graphics.setBackgroundColor(0x040811); 
      graphics.clear(); 
      graphics.drawBitmap(0, 0, header_Bitmap.getWidth(), 
        header_Bitmap.getHeight(), header_Bitmap, 0, 0); 
      super.paint(graphics); 
     } 
    }; 

enter image description here

Bitmap borderBitmap = //the rounded image; 
     VerticalFieldManager vfm_email = new VerticalFieldManager(); 
     vfm_email.setBorder(BorderFactory.createBitmapBorder(new XYEdges(5, 5, 
       5, 5), borderBitmap)); 
     EmailAddressEditField email = new EmailAddressEditField("Email : ", "", 50, Field.FOCUSABLE); 
     vfm_email.add(email); 
     vfm_.add(vfm_email); 
     add(vfm_); 
0

在上面的代碼什麼應在評論的背景圖像被寫入, 「img.bmp」,因爲它提供了一個錯誤 最終位圖header_Bitmap = 「img.bmp」; //背景圖;

VerticalFieldManager vfm_ = new VerticalFieldManager(
     Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR 
       | Manager.NO_VERTICAL_SCROLL 
       | Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH)