本文整理匯總了Java中com.google.android.gms.maps.model.Marker.setTag方法的典型用法代碼示例。如果您正苦於以下問題:Java Marker.setTag方法的具體用法?Java Marker.setTag怎麽用?Java Marker.setTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.maps.model.Marker
的用法示例。
在下文中一共展示了Marker.setTag方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setMarkers
import com.google.android.gms.maps.model.Marker; //導入方法依賴的package包/類
private void setMarkers(GoogleMap map, List<Restaurant> restaurants) {
if (map == null) {
return;
}
map.clear();
MarkerOptions options = new MarkerOptions().position(
new LatLng(Prefs.LastLatitude.getDouble(), Prefs.LastLongitude.getDouble()))
.icon(BitmapDescriptorFactory.fromResource(R.drawable.current_location));
map.addMarker(options);
for (Restaurant restaurant : restaurants) {
MarkerOptions markerOptions = new MarkerOptions().position(
new LatLng(restaurant.mLatitude, restaurant.mLongitude))
.title(restaurant.mName)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.restaurant_pin));
Marker marker = map.addMarker(markerOptions);
marker.setTag(restaurant);
}
mMap.setOnInfoWindowClickListener(mInfoWindowClickListener);
}
示例2: drawOnMap
import com.google.android.gms.maps.model.Marker; //導入方法依賴的package包/類
private Marker drawOnMap(Integer pointId){
//Bitmap btmp = BitmapFactory.decodeResource(activityContext.getResources(), icons.get(getPos()));
// Bitmap resizedBitmap = getMarker(pointId, activityContext);
Marker marker = map.addMarker(new MarkerOptions()
//.title(getPos() + " | " + getName())
.title(getName())
.snippet(getTitle())
.position(coordinates)
.anchor((float)0.5, (float)0.5)
.infoWindowAnchor((float)0.5, (float)0.2)
//.icon(BitmapDescriptorFactory.fromBitmap(btmp)));
// .icon(BitmapDescriptorFactory.fromBitmap(resizedBitmap)));
.icon(bitmapDescriptorFromVector(activityContext, getMarker(pointId, activityContext))));
// Storing the Point ID
marker.setTag(getIdPoint().toString());
return marker;
}
示例3: refreshMarkers
import com.google.android.gms.maps.model.Marker; //導入方法依賴的package包/類
private void refreshMarkers() {
// if (allMarkers.size() == allTrips.size()) return;
LatLngBounds.Builder boundBuilder = new LatLngBounds.Builder();
allMarkers.clear();
gMap.clear();
for (Trip t : allTrips) {
DateTime begDate = DateTime.parse(t.getStartDate());
DateTime endDate = DateTime.parse(t.getEndDate());
LatLng thisLoc = new LatLng(t.getLat(), t.getLng());
Marker m = gMap.addMarker(
new MarkerOptions().position(thisLoc).title(t.getName())
.snippet(formatDate(begDate, endDate)));
m.setTag(t);
allMarkers.add(m);
boundBuilder.include(thisLoc);
}
if (allMarkers.size() > 0) {
int screenWidth = getResources().getDisplayMetrics().widthPixels;
int screenHeight = getResources().getDisplayMetrics().heightPixels;
LatLngBounds bound = boundBuilder.build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bound,
screenWidth, screenHeight, 56);
gMap.animateCamera(cameraUpdate);
}
}
示例4: settaMarkersGiaPresenti
import com.google.android.gms.maps.model.Marker; //導入方法依賴的package包/類
/**
* Imposta un marker per ogni parcheggio già presente in zona
*/
void settaMarkersGiaPresenti() {
// rimuovi tutti i markers
for(Marker m : mMarkerListPresenti)
m.remove();
mMarkerListPresenti.clear();
// aggiungi un marker per ogni posizione
for (Parcheggio p : ElencoParcheggi.getInstance().getListParcheggi()) {
LatLng coordParcheggio = p.getCoordinate();
Marker marker = mMappa.addMarker(new MarkerOptions()
.position(coordParcheggio)
.title(p.getIndirizzo())
.icon(BitmapDescriptorFactory.defaultMarker(138)));
// Associo al marker un tag che corrisponde al parcheggio in questo modo posso
// poi eliminarlo direttamente
marker.setTag(p);
mMarkerListPresenti.add(marker);
}
mMainActivity.modificaTxtMarkerPresenti(ElencoParcheggi.getInstance().getListParcheggi().size());
}
示例5: 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);
}
}
示例6: collectLocationsAndPutOnMap
import com.google.android.gms.maps.model.Marker; //導入方法依賴的package包/類
private void collectLocationsAndPutOnMap(Map<String, Object> servings) {
//iterate through each user, ignoring their UID
for (Map.Entry<String, Object> entry : servings.entrySet()) {
//Get user map
singleUser = (Map) entry.getValue();
//Get phone field and append to list
latitudes.add((Double) singleUser.get("latitude"));
longitudes.add((Double) singleUser.get("longitude"));
keys.add((String) singleUser.get("key"));
userIds.add((String) singleUser.get("userId"));
//amount.add((Double) singleUser.get("price"));
titles.add((String) singleUser.get("title"));
}
for (int i = 0; i < latitudes.size(); i++) {
LatLng aLocation = new LatLng(
latitudes.get(i), longitudes.get(i)
);
BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.drawable.wii);
Bitmap b=bitmapdraw.getBitmap();
Bitmap smallMarker = Bitmap.createScaledBitmap(b, 150, 150, false);
Marker marker = googleMap.addMarker(new MarkerOptions()
.position(aLocation)
.title(titles.get(i))
.icon(BitmapDescriptorFactory.
fromBitmap(smallMarker))
);
marker.setTag(keys.get(i));
marker.showInfoWindow();
/*googleMap.addMarker(new MarkerOptions()
.position(new LatLng(
20, -25))
.title("fake location"));*/
}
}