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

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

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

Marker.setIcon介绍

暂无

代码示例

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

/**
 * Enlarges or shrinks a bitmap image based on the scale provided
 * @param style     Style to retrieve iconUrl and scale from
 * @param placemarks
 * @param placemark Placemark object to set the image to
 */
private void scaleBitmap(KmlStyle style, HashMap<KmlPlacemark, Object> placemarks,
             KmlPlacemark placemark) {
  double bitmapScale = style.getIconScale();
  String bitmapUrl = style.getIconUrl();
  Bitmap bitmapImage = getImagesCache().get(bitmapUrl);
  BitmapDescriptor scaledBitmap = scaleIcon(bitmapImage, bitmapScale);
  ((Marker) placemarks.get(placemark)).setIcon(scaledBitmap);
 }

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

@Override
public boolean onMarkerClick(Marker marker) {
  float newHue = MARKER_HUES[new Random().nextInt(MARKER_HUES.length)];
  mMarkerInfo.mHue = newHue;
  marker.setIcon(BitmapDescriptorFactory.defaultMarker(newHue));
  return true;
}

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

} else if (marker.equals(mAdelaide)) {
  marker.setIcon(BitmapDescriptorFactory.defaultMarker(mRandom.nextFloat() * 360));
  marker.setAlpha(mRandom.nextFloat());

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

@Override
public void setIcon(BitmapDescriptor icon) {
  if (virtual != null) {
    virtual.setIcon(icon);
  }
}

代码示例来源:origin: car2go/AnyMaps

@Override
public void setIcon(BitmapDescriptor icon) {
  BitmapDescriptorAdapter adapter = (BitmapDescriptorAdapter) icon;
  marker.setIcon(adapter.wrappedDescriptor);
}

代码示例来源:origin: owntracks/android

@Override
  protected void onPostExecute(BitmapDescriptor result) {
    Marker marker = target.get();
    if(marker != null) {
      marker.setIcon(result);
      marker.setVisible(true);
    }
  }
}

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

public void setIcon(BitmapDescriptor icon) {
  if (marker != null) {
    marker.setIcon(icon);
  } else {
    markerOptions.icon(icon);
  }
}

代码示例来源:origin: SkyTreasure/Airbnb-Android-Google-Map-View

private void resetMarkers() {
  for (Marker marker : this.markers) {
    marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
  }
}

代码示例来源:origin: SkyTreasure/Airbnb-Android-Google-Map-View

/**
 * Highlight the marker by marker.
 */
private void highLightMarker(Marker marker) {
  /*
  for (Marker foundMarker : this.markers) {
    if (!foundMarker.equals(marker)) {
      foundMarker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
    } else {
      foundMarker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));
      foundMarker.showInfoWindow();
    }
  }
  */
  marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));
  //  marker.showInfoWindow();
  //marker.remove();
  //Utils.bounceMarker(googleMap, marker);
  this.selectedMarker = marker;
}

代码示例来源:origin: ac-opensource/MarkerBuilder

public MarkerAreaWrapper(Context context, GoogleMap map, boolean isEnabled, LatLng center, int count, Boolean shouldExpand, ArrayList<Object> locationData, int centerDrawableId) {
  this.isEnabled = isEnabled;
  this.count = count;
  this.mapAreaType = DATA_POINT_WRAPPER;
  this.shouldExpand = shouldExpand;
  this.locationData = locationData;
  centerMarker = map.addMarker(new MarkerOptions()
      .position(center)
      .flat(true)
      .draggable(isEnabled));
  if (centerDrawableId != -1) {
    BitmapDrawable bitmapDrawable = (BitmapDrawable) context.getResources().getDrawable(centerDrawableId);
    Bitmap bitmap = bitmapDrawable.getBitmap();
    Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth()/2, bitmap.getHeight()/2, false);
    centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap));
  }
}

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

/**
 * Enlarges or shrinks a bitmap image based on the scale provided
 * @param style     Style to retrieve iconUrl and scale from
 * @param placemark Placemark object to set the image to
 */
private void scaleBitmap(KmlStyle style, HashMap<KmlPlacemark, Object> placemarks,
             KmlPlacemark placemark) {
  double bitmapScale = style.getIconScale();
  String bitmapUrl = style.getIconUrl();
  Bitmap bitmapImage = mImagesCache.get(bitmapUrl);
  BitmapDescriptor scaledBitmap = scaleIcon(bitmapImage, bitmapScale);
  ((Marker) placemarks.get(placemark)).setIcon(scaledBitmap);
 }

代码示例来源:origin: Bhoomika06/Styled-Map-Pager

previousSelectedMarker.setIcon(BitmapDescriptorFactory.fromBitmap(
          BitmapFactory.decodeResource(getResources(),
              R.drawable.ic_near_normal_pin)));
    } else if (map.getCameraPosition().zoom < 13) {
      previousSelectedMarker.setIcon(BitmapDescriptorFactory.fromBitmap(
          BitmapFactory.decodeResource(getResources(),
              R.drawable.ic_normal_pin)));
marker.setIcon(null);
marker.setIcon(BitmapDescriptorFactory.fromBitmap(
    BitmapFactory.decodeResource(getResources(),
        R.drawable.ic_selected_pin)));

代码示例来源:origin: ac-opensource/MarkerBuilder

Bitmap bitmap = bitmapDrawable.getBitmap();
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth()/2, bitmap.getHeight()/2, false);
centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(scaledBitmap));

代码示例来源:origin: SkyTreasure/Airbnb-Android-Google-Map-View

prevMarker.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(temp.getRating())));
marker.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon()));
prevMarker = marker;
prevVendorName = myDealsList.get(position).getRating();

代码示例来源:origin: ac-opensource/MarkerBuilder

shape.draw(canvas);
resizerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap));

代码示例来源:origin: SkyTreasure/Airbnb-Android-Google-Map-View

prevMarker.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(temp.getRating())));
iconFactory.setContentView(view);
marker.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(temp.getRating())));
prevMarker = marker;
prevVendorName = myDealsList.get(Integer.parseInt(marker.getSnippet())).getRating();

代码示例来源:origin: ac-opensource/MarkerBuilder

shape.draw(canvas);
radiusMarker.setIcon(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap));
centerMarker.setIcon(BitmapDescriptorFactory.fromBitmap(overlay(scaledBitmap, getRoundedCornerBitmap(childProfileImage, imageSize))));

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

protected void updateItem(final Network network) {
  final Marker marker = this.getMarker(network);
  if (marker != null) {
    if (showDefaultIcon(network)) {
      if (marker.getAlpha() != DEFAULT_ICON_ALPHA) {
        marker.setIcon(getIcon(network));
        marker.setAlpha(DEFAULT_ICON_ALPHA);
      }
    }
    else {
      if (marker.getAlpha() == DEFAULT_ICON_ALPHA) {
        marker.setIcon(getIcon(network));
        marker.setAlpha(CUSTOM_ICON_ALPHA);
      }
    }
  }
  else if (network.isNew()) {
    // handle case where network was not added before because it is not new
    final boolean showNewDBOnly = prefs.getBoolean( ListFragment.PREF_MAP_ONLY_NEWDB, false );
    if (showNewDBOnly) {
      mClusterManager.addItem(network);
      mClusterManager.cluster();
    }
  }
}

代码示例来源:origin: car2go/AnyMaps

@Test
public void testDelegateMethods() throws Exception {
  // Given
  Marker marker = mock(Marker.class);
  BitmapDescriptor descriptor = mock(BitmapDescriptor.class);
  BitmapDescriptorAdapter adapter = new BitmapDescriptorAdapter(descriptor);
  MarkerAdapter markerAdapter = new MarkerAdapter(marker);
  // When
  markerAdapter.setVisible(true);
  markerAdapter.setIcon(adapter);
  markerAdapter.getPosition();
  markerAdapter.showInfoWindow();
  markerAdapter.remove();
  // Then
  verify(marker).setVisible(eq(true));
  verify(marker).setIcon(refEq(descriptor));
  verify(marker).getPosition();
  verify(marker).showInfoWindow();
  verify(marker).remove();
}

相关文章