当前位置: 首页>>代码示例>>Java>>正文


Java MapStyleOptions类代码示例

本文整理汇总了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);
}
 
开发者ID:bkhezry,项目名称:ExtraMapUtils,代码行数:21,代码来源:MapUtils.java

示例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));


}
 
开发者ID:ahmadnurhidayat,项目名称:Taxi-App-Android-XML,代码行数:19,代码来源:Home.java

示例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());
        }
    }
}
 
开发者ID:aliumujib,项目名称:Nibo,代码行数:21,代码来源:BaseNiboFragment.java

示例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);


}
 
开发者ID:CMPUT301F16T04,项目名称:Ridr,代码行数:23,代码来源:RideView.java

示例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);

}
 
开发者ID:CMPUT301F16T04,项目名称:Ridr,代码行数:18,代码来源:AcceptRiderView.java

示例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();
}
 
开发者ID:septadev,项目名称:SEPTA-Android,代码行数:23,代码来源:NextToArriveTripDetailActivity.java

示例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);
    }
}
 
开发者ID:bkhezry,项目名称:ExtraMapUtils,代码行数:12,代码来源:ListViewFragment.java

示例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);
}
 
开发者ID:Augugrumi,项目名称:SpaceRace,代码行数:9,代码来源:MapActivity.java

示例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));
}
 
开发者ID:ahmadnurhidayat,项目名称:Taxi-App-Android-XML,代码行数:15,代码来源:MyTrip.java

示例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));
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:15,代码来源:DisplayRunFragment.java

示例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();
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:19,代码来源:ChallengeReceiverFragment.java

示例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));
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:17,代码来源:RunFragment.java

示例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");
    }
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:33,代码来源:DisplayChallengeFragment.java

示例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){}
}
 
开发者ID:mremondi,项目名称:Hyke,代码行数:14,代码来源:NearMeFragment.java

示例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;
}
 
开发者ID:jineshfrancs,项目名称:ThemedGoogleMap,代码行数:15,代码来源:GoogleMapStyler.java


注:本文中的com.google.android.gms.maps.model.MapStyleOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。