通过触摸或点按在 Android 谷歌地图上添加标记 [英] Add Marker on Android Google Map via touch or tap
本文介绍了通过触摸或点按在 Android 谷歌地图上添加标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 Android 上使用 Google 地图开发地图应用程序.现在,我想通过在地图上触摸或点击在地图上添加标记.如何应用触摸事件在地图上放置标记?
I want to develop a Map Application using Google Map on Android. Now, I want to add marker on the map via Touch or Tap on the Map. How do I apply touch event to drop the marker on the map?
推荐答案
此代码已成功运行 我正在处理此代码此代码用于 Dynamic Draw
This code is Successful run I am working on that code this code is for Dynamic Draw
我认为这段代码可以帮助您在静态或动态两个地方都可以使用这段代码
I think this code help you more for Static or dynamic both places you can use this code
double latval = Double.parseDouble(jsonobject.getString("lat"));
double longval = Double.parseDouble(jsonobject.getString("lon"));
mMap.addMarker(new MarkerOptions()
.position(new LatLng( latval, longval))
.title(jsonobject.getString("country"))
.snippet("4 E. 28TH Street From $15 /per night")
.rotation((float) -15.0)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE))
);
if (i == 0) {
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng(latval, longval), 7));
mMap.addCircle(new CircleOptions()
.center(new LatLng(latval,longval))
.radius(5000)
.strokeColor(Color.RED)
.fillColor(Color.RED));
}
这篇关于通过触摸或点按在 Android 谷歌地图上添加标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文