本文整理汇总了Java中com.google.android.gms.maps.GoogleMap.setMapStyle方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleMap.setMapStyle方法的具体用法?Java GoogleMap.setMapStyle怎么用?Java GoogleMap.setMapStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.GoogleMap
的用法示例。
在下文中一共展示了GoogleMap.setMapStyle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectedStyle
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的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.GoogleMap; //导入方法依赖的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: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的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));
}
示例4: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的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));
}
示例5: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的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();
}
示例6: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的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));
}
示例7: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的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");
}
}
示例8: onMapReady
import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.getUiSettings().setMyLocationButtonEnabled(false);
mMap.setMyLocationEnabled(true);
mMap.setMaxZoomPreference(20);
if (getMapStyle() != null)
googleMap.setMapStyle(getMapStyle());
}