我的应用程序中有 Google map 。标记已经可以点击,但我正在寻找一种方法来使标题可点击以执行操作(例如转到地点“描述”页面)。这就是我的意思
public class MapFragment extends Fragment {
private GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_map, container,
false);
String myTag = getTag();
((PlacesAndMapActivity) getActivity()).setTabFragmentMap(myTag);
map = ((SupportMapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
map.addMarker(new MarkerOptions().position(new LatLng(34.039407, -118.254763))
.title("Restaurant 1"));
return rootView;
}
}
我可以让标题可点击吗?谢谢
最佳答案
您想使用 GoogleMap.OnInfoWindowClickListener
类概述 标记信息窗口上点击/点击事件的回调接口(interface)。
public abstract void onInfoWindowClick (Marker marker)
点击标记的信息窗口时调用。
关于java - Android 谷歌地图 v2 可点击标记标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28484564/