当前位置: 首页>>代码示例>>Java>>正文


Java Marker.setTitle方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.model.Marker.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Marker.setTitle方法的具体用法?Java Marker.setTitle怎么用?Java Marker.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.model.Marker的用法示例。


在下文中一共展示了Marker.setTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClusterItemClick

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
@Override
public boolean onClusterItemClick(Station station) {
    Location stationLocation = new Location("");
    stationLocation.setLatitude(Double.parseDouble(station.getLatitude()));
    stationLocation.setLongitude(Double.parseDouble(station.getLongitude()));
    Object[] markers = clusterManager.getMarkerCollection().getMarkers().toArray();
    for (Object m : markers) {
        if (m instanceof Marker) {
            Marker mark = (Marker) m;
            Location location = new Location("");
            location.setLatitude(mark.getPosition().latitude);
            location.setLongitude(mark.getPosition().longitude);
            if (location.distanceTo(stationLocation) == 0) {
                map.animateCamera(CameraUpdateFactory.newLatLng(station.getPosition()));
                mark.setTitle(gson.toJson(station));
                mark.showInfoWindow();
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:23,代码来源:MapFragment.java

示例2: initializeOtherUserMarkers

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
@Override
public void initializeOtherUserMarkers(ArrayList<User> initializedUsers) {
    ArrayList<Marker> otherUserMarkers = new ArrayList<>();

    for (User user : initializedUsers) {
        LatLng userLocation = new LatLng(user.getLatitude(), user.getLongitude());
        Marker otherUserMarker;

        otherUserMarker = setMarker(user, userLocation);

        otherUserMarker.setTitle(user.getFirstName() + " " + user.getLastName());
        otherUserMarkers.add(otherUserMarker);

        builder.include(userLocation);
        returnDistance(currentUser, user);
    }

    setContents(initializedUsers, otherUserMarkers);
}
 
开发者ID:a-deda,项目名称:share-location,代码行数:20,代码来源:MapFragment.java

示例3: refreshMarker

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
/**
 * Refreshes the marker according to its appearance strategy.
 *
 * @param marker marker object
 */
private void refreshMarker(com.ubudu.gmaps.model.Marker marker) {
    Marker m = customMarkersMap.get(marker);
    MarkerOptions mO = marker.getOptions();
    m.setIcon(mO.getIcon());
    m.setZIndex(mO.getZIndex());
    m.setVisible(mO.isVisible());
    m.setAlpha(mO.getAlpha());
    m.setDraggable(mO.isDraggable());
    m.setFlat(mO.isFlat());
    m.setAnchor(mO.getAnchorV(),mO.getAnchorU());
    m.setRotation(mO.getRotation());
    m.setSnippet(mO.getSnippet());
    m.setTitle(marker.getTitle());
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:20,代码来源:MapLayout.java

示例4: refreshZone

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
/**
 * Refreshes the polygon and  label marker of the given zone according to zone's appearance options.
 *
 * @param zone zone object
 */
private void refreshZone(Zone zone) {
    Pair<Marker,Polygon> markerAndPolygon = zoneVsMarkerAndPolygonMap.get(zone);
    ZoneOptions zoneOptions = zone.getOptions();
    //update polygon
    Polygon p = markerAndPolygon.second;
    PolygonOptions polygonOptions = zoneOptions.getPolygonOptions();
    p.setStrokeColor(polygonOptions.getStrokeColor());
    p.setStrokeWidth(polygonOptions.getStrokeWidth());
    p.setFillColor(polygonOptions.getFillColor());
    p.setGeodesic(polygonOptions.isGeodesic());
    p.setHoles(polygonOptions.getHoles());
    p.setVisible(polygonOptions.isVisible());
    p.setZIndex(polygonOptions.getZIndex());
    p.setClickable(polygonOptions.isClickable());

    Log.i(TAG,"updated polygon id: "+p.getId());

    //update label marker
    Marker m = markerAndPolygon.first;
    ZoneLabelOptions zoneLabelOptions = zoneOptions.getZoneLabelOptions();
    MarkerOptions mO = zoneLabelOptions.getLabelMarkerOptions();

    if(zoneLabelOptions.isDisplayLabel())
        mO.icon(BitmapDescriptorFactory.fromBitmap(getLabelBitmap(zone.getName(),zoneLabelOptions)));

    m.setIcon(mO.getIcon());
    m.setZIndex(mO.getZIndex());
    m.setVisible(mO.isVisible());
    m.setAlpha(mO.getAlpha());
    m.setAnchor(mO.getAnchorV(),mO.getAnchorU());
    m.setDraggable(mO.isDraggable());
    m.setFlat(mO.isFlat());
    m.setInfoWindowAnchor(mO.getInfoWindowAnchorV(),mO.getInfoWindowAnchorU());
    m.setRotation(mO.getRotation());
    m.setSnippet(mO.getSnippet());
    m.setTitle(zone.getName());
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:43,代码来源:MapLayout.java


注:本文中的com.google.android.gms.maps.model.Marker.setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。