답변

2

public final class ZoomScreenDemo extends UiApplication 
{ 
    public static void main(final String[] args) 
    { 
     // Create a new instance of the application and make the currently 
     // running thread the application's event dispatch thread. 
     UiApplication app = new ZoomScreenDemo(); 
     app.enterEventDispatcher(); 
    } 


/** 
* Creates a new ZoomScreenDemo object 
*/ 
public ZoomScreenDemo() 
{ 
    UiApplication.getUiApplication().invokeLater(new Runnable() 
    { 
     public void run() 
     { 
      Dialog.alert("Click trackball or screen to zoom"); 
     } 
    }); 

    pushScreen(new ZoomScreenDemoScreen()); 
} 


public final static class ZoomScreenDemoScreen extends MainScreen 
{  
    private EncodedImage _image;   

    /** 
    * Creates a new ZoomScreenDemoScreen object 
    */ 
    public ZoomScreenDemoScreen() 
    {   
     setTitle("Zoom Screen Demo");   

     _image = EncodedImage.getEncodedImageResource("img/building.jpg");   
     BitmapField bitmapField = new BitmapField(_image.getBitmap(), FIELD_HCENTER | FOCUSABLE); 
     add(bitmapField);    
    }  


    /** 
    * @see Screen#navigationClick(int, int) 
    */ 
    protected boolean navigationClick(int status, int time) 
    { 
     // Push a new ZoomScreen if track ball or screen is clicked 
     UiApplication.getUiApplication().pushScreen(new ZoomScreen(_image));        
     return true; 
    } 


    /** 
    * @see Screen#touchEvent(TouchEvent) 
    */ 
    protected boolean touchEvent(TouchEvent message) 
    {  
     if(message.getEvent() == TouchEvent.CLICK) 
     { 
      UiApplication.getUiApplication().pushScreen(new ZoomScreen(_image));        
     } 
     return super.touchEvent(message);   
    } 
} 
} 
+0

우리가 또는 축소 화면에 줌지도에서 같은 UI를 추가 할 수 있습니다이 코드를 시도? –

+0

예. 내가 맨 위에 게시 한 코드를 사용해보십시오. – Signare

+0

트랙볼을 클릭하거나 스크리닝을 확대/축소 할 수있는 사용자 정의 컨트롤을 추가 할 수 있습니까 ?? –

관련 문제