Android 无法在请求的地图图像上放置标记
很好,但我想在地图图像中的特定位置放置一个标记,如何做到这一点。这不是地图,而是地图的图像。在特定位置放置标记的示例:Android 无法在请求的地图图像上放置标记,android,google-maps,Android,Google Maps,很好,但我想在地图图像中的特定位置放置一个标记,如何做到这一点。这不是地图,而是地图的图像。在特定位置放置标记的示例: I want to have an image of a map of location whose latitude and longitude are known. So I use the code below-: String src = "http://maps.google.com/maps/api/staticmap?center=" + latitude +
I want to have an image of a map of location whose latitude and longitude are known. So I use the code below-:
String src = "http://maps.google.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=13&size=600x600&sensor=false";
Picasso.with(this).load(src).into(myEventMapImg);
public类MainActivity扩展了FragmentActivity{
私人谷歌地图;
私人来源;
私有标记源标记、目标标记;
私有数组列表destiLatLong;
私有整数计数=0;
//专用多段线选项lineOptions;
专用信标路由;
阵列列表点;
私营部门;
私有ArrayList MapsDirectionList;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(map==null){
map=((SupportMapFragment)getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
//map.setMyLocationEnabled(true);
}
MapsDirectionList=新的ArrayList();
来源=新车床(新双精度(“22.3000”)、新双精度(“70.7833”);
sourceMarker=map.addMarker(新MarkerOptions().position(source).icon(
位图描述符工厂
.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
destiLatLong=newarraylist();
添加(新的LatLng(Double.parseDouble(“21.7542”),Double
.70.6222);;
destiLatLong.add(新LatLng(Double.parseDouble(“23.0300”),Double
.parseDouble(“72.5800”);
添加(新的LatLng(Double.parseDouble(“21.1700”),Double
.parseDouble(“72.8300”);
添加(新的LatLng(Double.parseDouble(“22.5667”),Double
.parseDouble(“88.3667”);
destiLatLong.add(新LatLng(Double.parseDouble(“28.6100”),Double
.77.2300美元;
if(destiLatLong.size()>0){
runOnUiThread(新的Runnable(){
@凌驾
公开募捐{
pd=Utils.showProgressDialog(MainActivity.this,“Wait”,
“获得方向…”);
}
});
showDirection();
}
}
亲爱的先生们,我再次重申,这不是地图,这是我使用谷歌地图请求的地图图像。我也尝试了这一点,但没有用-:String src=“”+纬度+”,“+经度+”&zoom=13&markers=icon:“+”&size=600x600”;
public class MainActivity extends FragmentActivity{
private GoogleMap map;
private LatLng source;
private Marker sourceMarker, destiMarker;
private ArrayList<LatLng> destiLatLong;
private int count = 0;
// private PolylineOptions lineOptions;
private BeanRoute route;
ArrayList<LatLng> points;
private ProgressDialog pd;
private ArrayList<MapsDirection> MapsDirectionList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (map == null) {
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
// map.setMyLocationEnabled(true);
}
MapsDirectionList = new ArrayList<MapsDirection>();
source = new LatLng(new Double("22.3000"), new Double("70.7833"));
sourceMarker = map.addMarker(new MarkerOptions().position(source).icon(
BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
destiLatLong = new ArrayList<LatLng>();
destiLatLong.add(new LatLng(Double.parseDouble("21.7542"), Double
.parseDouble("70.6222")));
destiLatLong.add(new LatLng(Double.parseDouble("23.0300"), Double
.parseDouble("72.5800")));
destiLatLong.add(new LatLng(Double.parseDouble("21.1700"), Double
.parseDouble("72.8300")));
destiLatLong.add(new LatLng(Double.parseDouble("22.5667"), Double
.parseDouble("88.3667")));
destiLatLong.add(new LatLng(Double.parseDouble("28.6100"), Double
.parseDouble("77.2300")));
if (destiLatLong.size() > 0) {
runOnUiThread(new Runnable() {
@Override
public void run() {
pd = Utils.showProgressDialog(MainActivity.this, "Wait",
"Getting Direction...");
}
});
showDirection();
}
}