2011-12-29 3 views
4

私はOneMap Androidのアプリケーションを開発していますし、次のようにコードは次のとおりです。onCreate()でMapViewズームレベルを設定する方法は?

private MapView map; 

    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     map = (MapView) findViewById(R.id.map); 

     map.addLayer(new ArcGISTiledMapServiceLayer(Practice_3.this, 
       "http://www.onemap.sg/ArcGIS/rest/services/BASEMAP/MapServer"));} 

マップが最初のようにエミュレータ上にロードされたとき、私は、ズームレベルを設定する方法を考え出すで迷ってしまいました負荷は、地図が小さすぎます。

誰でも私にこれを手伝ってもらえますか?

ご協力いただければ幸いです。

+0

多くのチュートリアルは、Android搭載Googleマップアプリケーションでオンラインでご利用いただけます。あなたがそれらをチェックしていないようです。基本的なものにはstackoverflowを使用しないでください。 –

+0

@Yugandhar Babuあなたは正しいですが、ここの言葉はここではあまり見えません。 – atom2ueki

答えて

0
public class MyMap_MapControllerActivity extends MapActivity { 

    private MapView mapView; 
    //private MapController mapController; 
    MapView.LayoutParams lp; 
    int y = 10; 
     int x = 10; 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
     mapView = (MapView)findViewById(R.id.map_view); 
     mapView.setSatellite(true); 
     mapView.setStreetView(true); 
     mapView.setTraffic(true); 



    GeoPoint center = mapView.getMapCenter(); 
    int latSpan = mapView.getLatitudeSpan(); 
    int longSpan = mapView.getLongitudeSpan(); 




    lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT, 
    MapView.LayoutParams.WRAP_CONTENT, 
    x, y, 
    MapView.LayoutParams.TOP_LEFT); 
    View zoomControls = mapView.getZoomControls(); 
    mapView.addView(zoomControls, lp); 
    mapView.displayZoomControls(true); 
    } 



    @Override 
    protected boolean isRouteDisplayed() { 
     // TODO Auto-generated method stub 
     return false; 
    } 
    } 
+0

こんにちは、あなたの返事には大変感謝しています。 – user1097856

0

まず、現在の場所を知っている必要があります。新しい場所apiを使用できるようになりました。こちらはguideです。 は、あなたがのonCreate下.connect()LocationClientOnconnect()

LatLng latlng = new LatLng(location.getLatitude(),location.getLongitude());   
map.moveCamera(CameraUpdateFactory.newLatLng(latlng)); 
map.animateCamera(CameraUpdateFactory.zoomTo(2.0f)); 

下のコマンドの下に追加しますが、覚えています()。ここ

は、あなたがそれをyou`reは、ArcGISのマップを使用してのように見えます Android: at com.google.android.gms.internal.u.y(Unknown Source)

0

に従わない場合は、あなたが取得するエラーメッセージです。 マップの起動時にズームレベルを設定するには、次のサンプルコードを使用してください。あなたも活動ファイルで設定することができます

<com.esri.android.map.MapView 
    android:id="@+id/map" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    mapoptions.MapType="Topo" 
    mapoptions.ZoomLevel="13" 
    mapoptions.center="33.666354, -117.903557" /> 

MapOptions options = new MapOptions(MapType.TOPO, 23, -110, 9); 

それはあなたのために働くなら、私に教えてください。

関連する問題