本文整理汇总了Java中com.google.android.gms.maps.model.MapStyleOptions类的典型用法代码示例。如果您正苦于以下问题:Java MapStyleOptions类的具体用法?Java MapStyleOptions怎么用?Java MapStyleOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapStyleOptions类属于com.google.android.gms.maps.model包,在下文中一共展示了MapStyleOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectedStyle
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
private static void setSelectedStyle(StyleDef styleName, GoogleMap googleMap, Context context) {
MapStyleOptions style;
switch (styleName) {
case RETRO:
style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_retro);
break;
case NIGHT:
style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_night);
break;
case GRAY_SCALE:
style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_grayscale);
break;
case DEFAULT:
style = null;
break;
default:
return;
}
googleMap.setMapStyle(style);
}
示例2: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
boolean success = googleMap.setMapStyle(new MapStyleOptions(getResources()
.getString(R.string.style_json)));
if (!success) {
Log.e("Style", "Style parsing failed.");
}
LatLng jakarta = new LatLng(-6.232812, 106.820933);
LatLng southjakarta = new LatLng(-6.22865,106.8151753);
mMap.addMarker(new MarkerOptions().position(jakarta).icon(BitmapDescriptorFactory.fromBitmap(getBitmapFromView("Set Pickup Location", R.drawable.dot_pickup))));
mMap.addMarker(new MarkerOptions().position(southjakarta).icon(BitmapDescriptorFactory.fromBitmap(getBitmapFromView("Set Dropoff Location", R.drawable.dot_dropoff))));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(jakarta, 15f));
}
示例3: getMapStyle
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
protected MapStyleOptions getMapStyle() {
if (mStyleEnum == NiboStyle.CUSTOM) {
if (mStyleFileID != DEFAULT_MARKER_ICON_RES) {
return MapStyleOptions.loadRawResourceStyle(
getActivity(), mStyleFileID);
} else {
throw new IllegalStateException("NiboStyle.CUSTOM requires that you supply a custom style file, you can get one at https://snazzymaps.com/explore");
}
} else if (mStyleEnum == NiboStyle.DEFAULT) {
return null;
} else {
if (mStyleEnum == null) {
return null;
}
{
return MapStyleOptions.loadRawResourceStyle(
getActivity(), mStyleEnum.getValue());
}
}
}
示例4: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
// Basic thing to do when the map is setup
// Callback for when the googleMap object is set up
public void onMapReady(GoogleMap googleMap) {
// Make our map a map
map = googleMap;
Calendar current = Calendar.getInstance();
// Add night view for nice viewing when it's dark out
// Dark styling is easier on the eyes
SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss");
if (nightTime(time.format(current.getTime()))) {
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(this, R.raw.maps_night_style);
map.setMapStyle(style);
}
// Let's listen for clicks on our markers to display information
map.setOnMarkerClickListener(showInfoWindow);
}
示例5: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
gMap = googleMap;
Calendar current = Calendar.getInstance();
// Add night view for nice viewing when it's dark out
// Dark styling is easier on the eyes
SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss");
if (nightTime(time.format(current.getTime()))) {
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(this, R.raw.maps_night_style);
gMap.setMapStyle(style);
}
setupMap(request);
}
示例6: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
this.googleMap = googleMap;
//googleMap.getUiSettings().setScrollGesturesEnabled(false);
//googleMap.getUiSettings().setZoomControlsEnabled(false);
//googleMap.getUiSettings().setZoomGesturesEnabled(false);
googleMap.getUiSettings().setAllGesturesEnabled(false);
googleMap.getUiSettings().setMapToolbarEnabled(false);
googleMap.setOnMarkerClickListener(
new GoogleMap.OnMarkerClickListener() {
public boolean onMarkerClick(Marker marker) {
return true;
}
});
MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(this, R.raw.maps_json_styling);
googleMap.setContentDescription("Map displaying selected route between " + start.getStopName() + " and " + destination.getStopName() + " with your vehicle location.");
googleMap.setMapStyle(mapStyle);
updateMap();
}
示例7: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
MapsInitializer.initialize(context);
MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_night);
map = googleMap;
map.setMapStyle(style);
final ViewOption viewOption = (ViewOption) mapView.getTag();
if (viewOption != null) {
setMapLocation(viewOption, map, context);
}
}
示例8: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
this.map = googleMap;
map.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
this, SharedPreferencesManager.getMapStyle()));
map.setMinZoomPreference(8.0f);
}
示例9: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
boolean success = googleMap.setMapStyle(new MapStyleOptions(getResources()
.getString(R.string.style_json)));
if (!success) {
Log.e("Style", "Style parsing failed.");
}
LatLng jakarta = new LatLng(-6.232812, 106.820933);
mMap.addMarker(new MarkerOptions().position(jakarta).icon(BitmapDescriptorFactory.fromBitmap(getBitmapFromView("Set Pickup Location", R.drawable.dot_pickup))));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(jakarta, 15f));
}
示例10: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
/**
* Called when the <code>GoogleMap</code> is ready. Initialize a MapHandler.
*
* @param googleMap the <code>GoogleMap</code>
*/
@Override
public void onMapReady(GoogleMap googleMap) {
MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);
googleMap.setMapStyle(mapStyle);
UtilsUI.recapDisplayTrackSetupUI(googleMap);
UtilsUI.recapDisplayTrack(runToBeDisplayed.getTrack(), googleMap,
ContextCompat.getColor(getContext(), R.color.colorAccent));
}
示例11: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
/**
* Called when the GoogleMap is ready. Initializes a MapHandler.
*
* @param googleMap The GoogleMap, must be non null.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
if (googleMap == null) {
throw new IllegalArgumentException("The GoogleMap can't be null");
}
MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);
googleMap.setMapStyle(mapStyle);
mapHandler = new MapHandler(googleMap, ContextCompat.getColor(getContext(), R.color.colorAccent));
mapHandler.setupRunningMapUI();
}
示例12: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
/**
* Called when the GoogleMap is ready. Initialize a MapHandler.
*
* @param googleMap The GoogleMap must be non null.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
if (googleMap == null) {
throw new IllegalArgumentException("The GoogleMap must be non null");
}
MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);
googleMap.setMapStyle(mapStyle);
mapHandler = new MapHandler(googleMap, ContextCompat.getColor(getContext(), R.color.colorAccent));
}
示例13: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
/**
* Called when the <code>GoogleMap</code> is ready. Initialize a MapHandler.
*
* @param googleMap the <code>GoogleMap</code>
*/
@Override
public void onMapReady(GoogleMap googleMap) {
MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);
switch(currentMapType) {
case USER_MAP:
Track userTrack = challengeToBeDisplayed.getMyRun().getTrack();
googleMap.setMapStyle(mapStyle);
UtilsUI.recapDisplayTrack(userTrack, googleMap, userColor);
UtilsUI.recapDisplayTrackSetupUI(googleMap);
currentMapType = MapType.OPPONENT_MAP;
opponentMapView.getMapAsync(this);
break;
case OPPONENT_MAP:
Track opponentTrack = challengeToBeDisplayed.getOpponentRun().getTrack();
googleMap.setMapStyle(mapStyle);
UtilsUI.recapDisplayTrack(opponentTrack, googleMap, opponentColor);
UtilsUI.recapDisplayTrackSetupUI(googleMap);
break;
default:
throw new IllegalStateException("unknown map type");
}
}
示例14: onMapReady
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap map) {
googleMap = map;
try {
googleMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
this.getContext(), R.raw.style_json));
googleMap.setMyLocationEnabled(true);
if (location != null){
loadLocationByLatLng();
}
}catch (SecurityException e){}
}
示例15: build
import com.google.android.gms.maps.model.MapStyleOptions; //导入依赖的package包/类
/**
* Call this method to build the GoogleMapStyler
*
* @return GoogleMapStyler
*/
public GoogleMapStyler build() {
if (json.length() > 1) {
json = json.deleteCharAt(json.length() - 1);
}
json = json.append("]");
String temp = json.toString().replaceAll("\\\\", "");
googleMapStyler.setMapStyleOptions(new MapStyleOptions(temp));
return googleMapStyler;
}