2016-07-22 6 views
1

MapContainer(cn1lib)を使用しています。したがって、アンドロイドデバイスでは、低解像度ではズームがうまく動作します。しかし、アンドロイドデバイスの高解像度では、うまく動作しません。ズームインは遠くにある。私は最大のズームを持つ画面を添付して、それはバグか私は間違っていますか?CodenameOne MapContainerズームレベル

SCREENSHOT

GUI-DESIGN

パブリッククラスステートマシンはStateMachineBase {

MapContainer mapContainer; 

public StateMachine(String resFile) { 
    super(resFile); 
    // do not modify, write code in initVars and initialize class members there, 
    // the constructor might be invoked too late due to race conditions that might occur 
} 

/** 
* this method should be used to initialize variables instead of the 
* constructor/class scope to avoid race conditions 
*/ 
protected void initVars(Resources res) { 
} 

@Override 
protected void beforeShow(Form f) { 
    try { 

     this.mapContainer.setShowMyLocation(true); 
     this.mapContainer.zoom(new Coord(20.640086, -103.432207), 17); 
     this.mapContainer.setCameraPosition(new Coord(20.640086, -103.432207)); 
     this.mapContainer.addMarker(
       EncodedImage.createFromImage(fetchResourceFile().getImage("pin.png"), false), 
       new Coord(20.640086, -103.432207), 
       "Hi marker", "Optional long description", 
       new ActionListener() { 
        public void actionPerformed(ActionEvent evt) { 
         Dialog.show("Marker Clicked!", "You clicked the marker", "OK", null); 
        } 
       } 
     ); 


     this.mapContainer.addPointerDraggedListener(new ActionListener() { 
      @Override 
      public void actionPerformed(ActionEvent evt) { 
       mapContainer.clearMapLayers(); 
       mapContainer.addMarker(EncodedImage.createFromImage(fetchResourceFile().getImage("pin.png"), false), mapContainer.getCameraPosition(), "Hi marker", "Optional long description", new ActionListener() { 
        public void actionPerformed(ActionEvent evt) { 
         Dialog.show("Marker Clicked!", "You clicked the marker", "OK", null); 
        } 
       }); 

      } 
     }); 

    } catch (Exception ex) { 
     ex.printStackTrace(); 
    } 
    super.beforeShow(f); //To change body of generated methods, choose Tools | Templates. 
} 

@Override 
protected Component createComponentInstance(String componentType, Class cls) { 
    if (cls == MapComponent.class) {  
     this.mapContainer = new MapContainer(); 
     return this.mapContainer; 
    } 
    return super.createComponentInstance(componentType, cls); //To change body of generated methods, choose Tools | Templates. 
} 

}

+0

あなたのお手伝いをするために、いくつかのコードを記入してください。 – Bek

+0

私は投稿を更新しました、ありがとう –

答えて

0

を拡張MapComponentないネイティブのマップなので、古いオープンストリートマップのサポートを使用していることデバイス上でさえも比較的単純なマップレンダリングが可能です。 native google mapsはGUIビルダーでは公開されていませんが、コードを追加することができます。

これは、実際のネイティブGUIを、シミュレータ上では同じように見えますが、デバイス上で見た目も気分も良くなる場所に埋め込みます。

+0

ありがとう、完璧に、あなたは私を救う –