本文介绍了使用Google maps api v2添加默认位置标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Google maps api v2合并到我的应用程序中以提供带有地图片段的活动但我无法找到相关代码来添加默认位置标记。例如,当活动加载时,它将居中在街道上一个标记,例如老特拉福德体育场,曼彻斯特。我已经激活了我的权限并获得了api密钥并且还添加了相关的地图片段,这是我的地图类:
I have a Google maps api v2 incorporated into my app to provide an activity with a map fragment but I cant find relevant code to add a default location marker.For example when the activity is loaded it will be centered on a street with a marker,eg Old Trafford Stadium,Manchester.I have activated my permissions and got the api key and also added the relevant map fragment,This is my map class:
<pre>package com.example.g00290342bvarley;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
import android.view.Menu;
public class MapGmit extends MapActivity {
MapView map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_gmit);
map = (MapView)findViewById(R.id.map);
map.setBuiltInZoomControls(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.map_gmit, menu);
return true;
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
推荐答案
这篇关于使用Google maps api v2添加默认位置标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!