如何在Google Maps Api v3 android中将图像添加到信息窗口

时间:2016-11-10 15:40:49

标签: android google-maps google-maps-api-3

我想知道如何在Google地图标记的信息框事件中添加图片。

大家好!我需要一些关于如何在信息框事件中添加图像的帮助,当您单击标记时显示该信息。

public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_FINE_LOCATION)
                == PackageManager.PERMISSION_GRANTED) {
            buildGoogleApiClient();
            mMap.setMyLocationEnabled(true);
        }
    }
    else {
        buildGoogleApiClient();
        mMap.setMyLocationEnabled(true);
    }
    //Parking 1 Central Park Rua Arlindo Colaço - SM 216
     LatLng est1 = new LatLng(-23.492668, -46.4419270);
    mMap.addMarker(new MarkerOptions().position(est1).title("Central Park").snippet("Rua Arlindo Colaço, 216"));

这个和平的代码在我的android项目的谷歌地图中添加了一个标记,它显示信息“中央公园”作为标题和“RuaArlingoColaço,216”作为文本行。

1 个答案:

答案 0 :(得分:1)

您所要做的就是自定义信息窗口。请看一下: Custom info window for google maps android