com.google.android.gms.maps.model.Marker类的使用及代码示例

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

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

Marker介绍

暂无

代码示例

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

private MarkerWithPosition(Marker marker) {
  this.marker = marker;
  position = marker.getPosition();
}

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

public View getInfoContents(Marker arg0) {
    View view =  LayoutInflater.from(mContext).inflate(R.layout.amu_info_window, null);
    TextView infoWindowText = (TextView) view.findViewById(R.id.window);
    if (arg0.getSnippet() != null) {
      infoWindowText.setText(Html.fromHtml(arg0.getTitle() + "<br>" + arg0.getSnippet()));
    } else {
      infoWindowText.setText(Html.fromHtml(arg0.getTitle()));
    }
    return view;
  }
});

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

public void clear() {
  for (Marker marker : mMarkers) {
    marker.remove();
    mAllMarkers.remove(marker);
  }
  mMarkers.clear();
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onSuccess() {
  if (marker != null && marker.isInfoWindowShown()) {
   marker.showInfoWindow();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@SuppressLint("InflateParams")
@Override
public View getInfoContents(Marker marker) {
 if (popup == null) {
  popup=inflater.inflate(R.layout.popup, null);
 }
 if (lastMarker == null
   || !lastMarker.getId().equals(marker.getId())) {
  lastMarker=marker;
  TextView tv=(TextView)popup.findViewById(R.id.title);
  tv.setText(marker.getTitle());
  tv=(TextView)popup.findViewById(R.id.snippet);
  tv.setText(marker.getSnippet());
  Uri image=images.get(marker.getId());
  ImageView icon=(ImageView)popup.findViewById(R.id.icon);
  if (image == null) {
   icon.setVisibility(View.GONE);
  }
  else {
   icon.setVisibility(View.VISIBLE);
   Picasso.with(ctxt).load(image).resize(iconWidth, iconHeight)
       .centerCrop().noFade()
       .placeholder(R.drawable.placeholder)
       .into(icon, new MarkerCallback(marker));
  }
 }
 return(popup);
}

代码示例来源: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();
}

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

flag = false;
mViewPager.setVisibility(View.VISIBLE);
String aid = marker.getId().substring(1, marker.getId().length());
  prevMarker.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(temp.getRating())));
if (!marker.equals(prevMarker)) {
  tvVendorTitle.setText(myDealsList.get(Integer.parseInt(marker.getSnippet())).getRating());
  iconFactory.setContentView(view);
  marker.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(temp.getRating())));
  prevMarker = marker;
  prevVendorName = myDealsList.get(Integer.parseInt(marker.getSnippet())).getRating();
prevVendorName = myDealsList.get(Integer.parseInt(marker.getSnippet())).getRating();
mMap.moveCamera(CameraUpdateFactory.newLatLng(marker.getPosition()));
flag = true;

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onMarkerClick(Marker marker) {
 Toast.makeText(this, marker.getTitle(), Toast.LENGTH_LONG).show();
 return(false);
}

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

@Override
public boolean onMarkerClick(final Marker marker) {
  if (marker.equals(mPerth)) {
  } else if (marker.equals(mAdelaide)) {
    marker.setIcon(BitmapDescriptorFactory.defaultMarker(mRandom.nextFloat() * 360));
    marker.setAlpha(mRandom.nextFloat());
  float zIndex = marker.getZIndex() + 1.0f;
  marker.setZIndex(zIndex);
  Toast.makeText(this, marker.getTitle() + " z-index set to " + zIndex,
      Toast.LENGTH_SHORT).show();

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

public boolean onMarkerMoved(Marker marker) {
  if (marker.equals(mCenterMarker)) {
    mCircle.setCenter(marker.getPosition());
    mRadiusMarker.setPosition(toRadiusLatLng(marker.getPosition(), mRadiusMeters));
    return true;
  }
  if (marker.equals(mRadiusMarker)) {
    mRadiusMeters =
        toRadiusMeters(mCenterMarker.getPosition(), mRadiusMarker.getPosition());
    mCircle.setRadius(mRadiusMeters);
    return true;
  }
  return false;
}

代码示例来源:origin: airbnb/AirMapView

@Override public void moveMarker(AirMapMarker<?> marker, LatLng to) {
 marker.setLatLng(to);
 marker.getMarker().setPosition(to);
}

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

if (marker.equals(mBrisbane)) {
  badge = R.drawable.badge_qld;
} else if (marker.equals(mAdelaide)) {
  badge = R.drawable.badge_sa;
} else if (marker.equals(mSydney)) {
  badge = R.drawable.badge_nsw;
} else if (marker.equals(mMelbourne)) {
  badge = R.drawable.badge_victoria;
} else if (marker.equals(mPerth)) {
  badge = R.drawable.badge_wa;
} else if (marker.equals(mDarwin1)) {
  badge = R.drawable.badge_nt;
} else if (marker.equals(mDarwin2)) {
  badge = R.drawable.badge_nt;
} else if (marker.equals(mDarwin3)) {
  badge = R.drawable.badge_nt;
} else if (marker.equals(mDarwin4)) {
  badge = R.drawable.badge_nt;
} else {
String title = marker.getTitle();
TextView titleUi = ((TextView) view.findViewById(R.id.title));
if (title != null) {
String snippet = marker.getSnippet();
TextView snippetUi = ((TextView) view.findViewById(R.id.snippet));
if (snippet != null && snippet.length() > 12) {

代码示例来源:origin: AppLozic/Applozic-Android-SDK

@Override
  public void onMarkerDragEnd(Marker marker) {
    if (myLocationMarker != null) {
      myLocationMarker.remove();
    }
    MarkerOptions newMarkerOptions = new MarkerOptions();
    newMarkerOptions.draggable(true);
    myLocationMarker = googleMap.addMarker(newMarkerOptions.position(marker.getPosition()).title(""));
  }
});

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

for (BikeRentalStation bikeRentalStation : listOfBikeRentalStations) {
  for (Map.Entry<Marker, BikeRentalStationInfo> entry : mBikeRentalStations.entrySet()) {
    if (entry.getKey().getTitle().equals(bikeRentalStation.name)) {
      entry.getKey().setSnippet(getResources()
          .getString(R.string.map_markers_bike_rental_available_bikes) + " " +
          bikeRentalStation.bikesAvailable + " | " + getResources()
          bikeRentalStation.spacesAvailable);
    if (entry.getKey().isInfoWindowShown()) {
      entry.getKey().showInfoWindow();

代码示例来源: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: ac-opensource/MarkerBuilder

if (marker.equals(centerMarker)) {
  onCenterUpdated(marker.getPosition());
  return MarkerMoveResult.moved;
if (marker.equals(resizerMarker)) {
  double newRadius = MarkerAreasUtils.toRadiusMeters(centerMarker.getPosition(), marker.getPosition());

代码示例来源:origin: square/assertj-android

public MarkerAssert hasSnippet(String snippet) {
 isNotNull();
 String actualSnippet = actual.getSnippet();
 assertThat(actualSnippet) //
   .overridingErrorMessage("Expected snippet <%s> but was <%s>.", snippet, actualSnippet) //
   .isEqualTo(snippet);
 return this;
}

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

public void showAll() {
  for (Marker marker : mMarkers) {
    marker.setVisible(true);
  }
}

代码示例来源:origin: Phantast/smartnavi

public void setDestPosition(LatLng z) {
  destMarker.setPosition(z);
  destMarker.setVisible(true);
}

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

public void showInfoWindow() {
  if (marker != null) {
    marker.showInfoWindow();
  }
}

相关文章