Google Maps - Fokus setzen?

Z

Zaidy

Neues Mitglied
0
hallo

ich habe für mein android app eine google map erstellt. das funktioniert alles einwandfrei. nun wird aber sobald ich die map starte amerika gezeigt, jedoch befinden sich meine punkte alle in europa, daher wäre es besser wenn der focus gleich auf europa liegen würde.
kann man den focus irgendwie auf europa bzw. auf bestimmte punkte setzen?
ich habe leider nichts gefunden.

lg
 
Zum Beispiel so. Hier werden im Startintent koordinaten übergeben, und auf den Punkt mit Stufe 16 gezoomt. Zusätzlich wird hier noch ein "Fähnchen" (=Stechnadel) angezeigt.

Code:
[SIZE=2][COLOR=#7f0055]

[B][SIZE=2][COLOR=#7f0055]public
[/COLOR][/SIZE][/B][/COLOR][/SIZE][LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ActMap [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] MapActivity {[/SIZE]
 
[LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onCreate(Bundle savedInstanceState) {[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].onCreate(savedInstanceState);[/SIZE]
[SIZE=2]setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]map[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
 
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] MapView map = (MapView) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]map[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2]map.setSatellite([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] MapController mapControl = map.getController();[/SIZE]
[SIZE=2]mapControl.setZoom(16);[/SIZE]
[SIZE=2]map.setStreetView([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE]
[SIZE=2]map.setBuiltInZoomControls([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// check to see if we were launched with a browser intent... e.g. "[U]geoname[/U]://[U]loc[/U]/[U]yellowstone[/U]"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
[/COLOR][/SIZE][SIZE=2]Intent launchIntent = getIntent();[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (launchIntent != [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]) {[/SIZE]
[SIZE=2]Double lat = launchIntent.getDoubleExtra([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"lat"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 0.0)*1E6;[/SIZE]
[SIZE=2]Double lng = launchIntent.getDoubleExtra([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"lng"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], 0.0)*1E6;[/SIZE]
[SIZE=2]GeoPoint point = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] GeoPoint(lat.intValue(), lng.intValue());[/SIZE][/LEFT]
 
[LEFT][SIZE=2]mapControl.setCenter(point);[/SIZE][/LEFT]
 
[LEFT][SIZE=2]MapView.LayoutParams mapMarkerParams = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] MapView.LayoutParams([/SIZE]
[SIZE=2]LayoutParams.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]WRAP_CONTENT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], LayoutParams.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]WRAP_CONTENT[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], [/SIZE]
[SIZE=2]point, MapView.LayoutParams.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]CENTER[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] );[/SIZE]
[SIZE=2]ImageView mapMarker = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ImageView(getApplicationContext());[/SIZE]
[SIZE=2]mapMarker.setImageResource(R.drawable.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]stecknadel_gruen_transparent[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2]map.addView(mapMarker, mapMarkerParams);[/SIZE][/LEFT]
 
[LEFT][SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]boolean[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] isRouteDisplayed() {[/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// we do not display routes[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
 
[LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]protected[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]boolean[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] isLocationDisplayed() {[/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// we don't display sensor based location on the map[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE][/LEFT]
 
 
[LEFT][SIZE=2]}[/SIZE][/LEFT]
[/LEFT]
 
Danke für deinen Hinweis, hat mir auf jeden fall weiter geholfen bzw jz weiß ich wo ich ansetzen muss ;)
 

Ähnliche Themen

A
Antworten
1
Aufrufe
633
swa00
swa00
R
Antworten
3
Aufrufe
1.614
Ritartet
R
M
  • markusk73
Antworten
3
Aufrufe
860
swa00
swa00
Zurück
Oben Unten