简体   繁体   English

Android Google Maps v2可点击标记标题

[英]Android Google Maps v2 clickable marker title

I have a Google map on my app. 我的应用上有一张Google地图。 The markers are already clickable, but I'm looking for a way to make the title's clickable to do an action (like going to a places "description" page). 标记已经可以单击,但是我正在寻找一种方法来使标题可单击以执行操作(例如转到场所“描述”页面)。 Here is what I mean 这就是我的意思

http://i.imgur.com/ndwOjx9.png?1

    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;
    }
    }

Anyway I can make the title clickable? 无论如何,我可以使标题可点击吗? Thanks 谢谢

You want to use GoogleMap.OnInfoWindowClickListener 您想使用GoogleMap.OnInfoWindowClickListener

Class Overview Callback interface for click/tap events on a marker's info window. 类概述回调界面,用于标记的信息窗口上的单击/点击事件。

public abstract void onInfoWindowClick (Marker marker)

Called when the marker's info window is clicked. 单击标记的信息窗口时调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM