2010-03-02 4 views

답변

1

자신의 클래스를 만들어 BitmapField를 확장하고 paintBitmap() 메서드를 재정의 할 수 있습니다. 이처럼

:

public class MyBitmapField extends BitmapField { 
//...  
protected void paintBitmap(Graphics g, int arg1, int arg2, int arg3, 
     int arg4, Bitmap arg5, int arg6, int arg7) {    
    super.paintBitmap(g, arg1, arg2, arg3, arg4, arg5, arg6, arg7); 
    g.drawText("Your text", 5,5); 
} 

// ... 

} 

은 또한 당신은 drawFocus(), paintBackground() 등을 대체 할 수 있습니다.

1

또한 비트 맵을 통해 텍스트를 그릴 수 :

class Scr extends MainScreen { 
    Bitmap bmp = new Bitmap(200, 100); 

    public Scr() { 
     //draw bitmap 
     Graphics g = new Graphics(bmp); 
     g.drawLine(0, 0, 199, 99); 
     g.drawLine(199, 0, 0, 99); 

     //draw text 
     Font f = getFont().derive(Font.PLAIN, 15); 
     g.drawText("hello", 0, (bmp.getHeight() - f.getHeight()) >> 1, 
      DrawStyle.HCENTER|DrawStyle.VCENTER); 
     add(new BitmapField(bmp)); 
    } 
} 

다른 방법으로 Blackberry - fields layout animation

0

같은 사용자 지정 레이아웃을 구현 또는 a negative margin을 사용하는 것입니다 (소스 코드는 해당 페이지의 하단에 다운로드 할 수 있습니다) :

enter image description here

UPDATE :NegativeMarginVerticalFieldManager에 대한 또 하나의 링크

+0

깨진 링크, 코드를 입력하십시오. –

+1

여기 Google을 사용합니다. –