本文整理汇总了Java中com.google.android.gms.maps.model.Marker.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java Marker.setIcon方法的具体用法?Java Marker.setIcon怎么用?Java Marker.setIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.model.Marker
的用法示例。
在下文中一共展示了Marker.setIcon方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSpawnPoint
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
public static void setSpawnPoint(final Context context, final GoogleMap googleMap, final LatLng latLng){
Marker marker = googleMap.addMarker(new MarkerOptions()
.position(latLng));
marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
mSpawnPoints.add(marker);
// Put location into the database as 2 doubles with type Spawn Location.
DatabaseHelper myDb = DatabaseHelper.getInstance(context);
myDb.addLocation("Spawn Location", latLng.latitude, latLng.longitude, "No Description");
myDb.close();
}
示例2: showSpawnLocations
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
private static void showSpawnLocations(GoogleMap googleMap, LatLng latLng, String description, String time) {
Marker marker = googleMap.addMarker(new MarkerOptions().position(latLng));
marker.setSnippet(description);
marker.setTag(time + "");
marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
mSpawnPoints.add(marker);
if (marker.getTag() != "") {
mSpawnPointTimes.add(marker);
}
}
示例3: checkSpawnTimes
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
public static void checkSpawnTimes() {
if (mSpawnPoints.size() > 0) {
Calendar c = Calendar.getInstance();
int currentTime = c.get(Calendar.MINUTE);
for (Marker marker : mSpawnPointTimes) {
if (marker.getTag() != null) {
boolean overlap = false;
int startTime = Integer.parseInt(marker.getTag().toString());
int endTime = startTime + 30;
if (endTime >= 60) {
overlap = true;
endTime -= 60;
}
if (!overlap && currentTime >= startTime && currentTime <= endTime) {
marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
} else if (overlap && currentTime >= 30 && currentTime >= startTime && currentTime <= (startTime + 30)) {
marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
} else if (overlap && currentTime < 30 && currentTime <= endTime) {
marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
} else {
marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
}
}
}
}
}
示例4: 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());
}
示例5: 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());
}
示例6: updatePinIcons
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
private void updatePinIcons(boolean mini) {
for (Marker marker : markerList) {
// Z index is the review average value
marker.setIcon(AssetHelper.getCustomPin(marker.getZIndex(), mini));
}
}
示例7: onMarkerClick
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
/**
* Al click sul marker, se il marker selezionato è quello provvisorio, lo pone tra la lista di
* invio. Altrimenti, lo elimina
*/
@Override
public boolean onMarkerClick(final Marker marker) {
// distingui la tipologia di marker
String tipologia = tipologiaMarker(marker);
switch (tipologia) {
case M_PROVVISORIO: {
marker.setIcon(BitmapDescriptorFactory.defaultMarker(52));
mMarkerProvvisorio = null;
mMarkerListDaInviare.add(marker);
break;
}
case M_INVIARE: {
marker.remove();
mMarkerListDaInviare.remove(marker);
break;
}
case M_PRESENTE: {
AlertDialog.Builder alertElimina = new AlertDialog.Builder(mMainActivity);
alertElimina.setTitle(R.string.title_elimina);
alertElimina.setMessage(R.string.desc_elimina);
alertElimina.setPositiveButton(R.string.si, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// Recupero tramite Tag
final Parcheggio parcheggio = (Parcheggio) marker.getTag();
if(parcheggio != null)
{
mMainActivity.getAPIHandler().deleteLocation(parcheggio.getID(), new APIHandler.APICallback() {
@Override
public void onResult(boolean isError, JSONObject jsonObject) {
if(!isError)
{
mMainActivity.creaToast(R.string.posto_eliminato);
mMarkerListPresenti.remove(marker);
ElencoParcheggi.getInstance().getListParcheggi().remove(parcheggio);
mMainActivity.modificaTxtMarkerPresenti(mMarkerListPresenti.size());
marker.remove();
}
}
@Override
public void onAuthError() {
mMainActivity.creaToast(R.string.auth_error);
}
});
}
}
});
alertElimina.setNegativeButton(R.string.no, null);
AlertDialog alert = alertElimina.create();
alert.show();
break;
}
}
mMainActivity.modificaTxtMarkerDaCaricare(mMarkerListDaInviare.size());
mMainActivity.modificaTxtMarkerInSospeso(false);
// serve a gestire il comportamento di default della mappa:
// - return true: non mostrare animazione predefinita google.
// - return false: mostrala.
return true;
}