com.google.android.gms.maps.model.Marker.setTitle()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中com.google.android.gms.maps.model.Marker.setTitle()方法的一些代码示例,展示了Marker.setTitle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marker.setTitle()方法的具体详情如下:
包路径:com.google.android.gms.maps.model.Marker
类名称:Marker
方法名:setTitle

Marker.setTitle介绍

暂无

代码示例

代码示例来源:origin: googlemaps/android-maps-utils

/**
 * Sets a marker info window if no <text> tag was found in the KML document. This method sets
 * the marker title as the text found in the <name> start tag and the snippet as <description>
 *
 * @param style Style to apply
 */
private void setMarkerInfoWindow(KmlStyle style, Marker marker,
                 final KmlPlacemark placemark) {
  boolean hasName = placemark.hasProperty("name");
  boolean hasDescription = placemark.hasProperty("description");
  boolean hasBalloonOptions = style.hasBalloonStyle();
  boolean hasBalloonText = style.getBalloonOptions().containsKey("text");
  if (hasBalloonOptions && hasBalloonText) {
    marker.setTitle(style.getBalloonOptions().get("text"));
    createInfoWindow();
  } else if (hasBalloonOptions && hasName) {
    marker.setTitle(placemark.getProperty("name"));
    createInfoWindow();
  } else if (hasName && hasDescription) {
    marker.setTitle(placemark.getProperty("name"));
    marker.setSnippet(placemark.getProperty("description"));
    createInfoWindow();
  } else if (hasDescription) {
    marker.setTitle(placemark.getProperty("description"));
    createInfoWindow();
  } else if (hasName) {
    marker.setTitle(placemark.getProperty("name"));
    createInfoWindow();
  }
}

代码示例来源:origin: mg6maciej/android-maps-extensions

public void setTitle(String title) {
  if (marker != null) {
    marker.setTitle(title);
  } else {
    markerOptions.title(title);
  }
}

代码示例来源:origin: wiglenet/wigle-wifi-wardriving

/**
 * Sets a marker info window if no <text> tag was found in the KML document. This method sets
 * the marker title as the text found in the <name> start tag and the snippet as <description>
 *
 * @param style Style to apply
 */
private void setMarkerInfoWindow(KmlStyle style, Marker marker,
    final KmlPlacemark placemark) {
  boolean hasName = placemark.hasProperty("name");
  boolean hasDescription = placemark.hasProperty("description");
  boolean hasBalloonOptions = style.hasBalloonStyle();
  boolean hasBalloonText = style.getBalloonOptions().containsKey("text");
  if (hasBalloonOptions && hasBalloonText) {
    marker.setTitle(style.getBalloonOptions().get("text"));
    createInfoWindow();
  } else if (hasBalloonOptions && hasName) {
    marker.setTitle(placemark.getProperty("name"));
    createInfoWindow();
  } else if (hasName && hasDescription) {
    marker.setTitle(placemark.getProperty("name"));
    marker.setSnippet(placemark.getProperty("description"));
    createInfoWindow();
  } else if (hasDescription) {
    marker.setTitle(placemark.getProperty("description"));
    createInfoWindow();
  }
}

相关文章