Java Code Examples for com.google.android.gms.maps.model.MarkerOptions#draggable()
The following examples show how to use
com.google.android.gms.maps.model.MarkerOptions#draggable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkerActivity.java From Complete-Google-Map-API-Tutorial with Apache License 2.0 | 6 votes |
private void addMarkersToMap() { MarkerOptions options =new MarkerOptions(); options.position(BRISBANE); options.title("brisbane"); options.snippet("Population: 2,544,634"); options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)); options.draggable(true); CustomInfoWindowAdapter.brisbane=googleMap.addMarker(options); MarkerOptions options2 =new MarkerOptions(); options2.position(ADELAIDE); options2.title("adelaide"); options2.snippet("Population: 3,543,222"); Drawable drawable=ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_person_pin_circle_black_24dp); options2.icon(convertDrawableToBitmap(drawable)); options2.draggable(true); CustomInfoWindowAdapter.adelaide=googleMap.addMarker(options2); }
Example 2
Source File: GoogleMapShapeConverter.java From geopackage-android-map with MIT License | 6 votes |
/** * Add a list of LatLngs to the map * * @param map google map * @param latLngs lat lngs * @return multi marker */ public static MultiMarker addLatLngsToMap(GoogleMap map, MultiLatLng latLngs) { MultiMarker multiMarker = new MultiMarker(); for (LatLng latLng : latLngs.getLatLngs()) { MarkerOptions markerOptions = new MarkerOptions(); if (latLngs.getMarkerOptions() != null) { markerOptions.icon(latLngs.getMarkerOptions().getIcon()); markerOptions.anchor(latLngs.getMarkerOptions().getAnchorU(), markerOptions.getAnchorV()); markerOptions.draggable(latLngs.getMarkerOptions() .isDraggable()); markerOptions.visible(latLngs.getMarkerOptions().isVisible()); markerOptions.zIndex(latLngs.getMarkerOptions().getZIndex()); } Marker marker = addLatLngToMap(map, latLng, markerOptions); multiMarker.add(marker); } return multiMarker; }
Example 3
Source File: GeoJsonPointStyle.java From android-maps-utils with Apache License 2.0 | 6 votes |
/** * Gets a new MarkerOptions object containing styles for the GeoJsonPoint * * @return new MarkerOptions object */ public MarkerOptions toMarkerOptions() { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.alpha(mMarkerOptions.getAlpha()); markerOptions.anchor(mMarkerOptions.getAnchorU(), mMarkerOptions.getAnchorV()); markerOptions.draggable(mMarkerOptions.isDraggable()); markerOptions.flat(mMarkerOptions.isFlat()); markerOptions.icon(mMarkerOptions.getIcon()); markerOptions.infoWindowAnchor(mMarkerOptions.getInfoWindowAnchorU(), mMarkerOptions.getInfoWindowAnchorV()); markerOptions.rotation(mMarkerOptions.getRotation()); markerOptions.snippet(mMarkerOptions.getSnippet()); markerOptions.title(mMarkerOptions.getTitle()); markerOptions.visible(mMarkerOptions.isVisible()); markerOptions.zIndex(mMarkerOptions.getZIndex()); return markerOptions; }
Example 4
Source File: GoogleMapShapeConverter.java From geopackage-android-map with MIT License | 5 votes |
/** * Add the list of points as markers * * @param map google map * @param points points * @param customMarkerOptions custom marker options * @param ignoreIdenticalEnds ignore identical ends flag * @return list of markers */ public List<Marker> addPointsToMapAsMarkers(GoogleMap map, List<LatLng> points, MarkerOptions customMarkerOptions, boolean ignoreIdenticalEnds) { List<Marker> markers = new ArrayList<Marker>(); for (int i = 0; i < points.size(); i++) { LatLng latLng = points.get(i); if (points.size() > 1 && i + 1 == points.size() && ignoreIdenticalEnds) { LatLng firstLatLng = points.get(0); if (latLng.latitude == firstLatLng.latitude && latLng.longitude == firstLatLng.longitude) { break; } } MarkerOptions markerOptions = new MarkerOptions(); if (customMarkerOptions != null) { markerOptions.icon(customMarkerOptions.getIcon()); markerOptions.anchor(customMarkerOptions.getAnchorU(), customMarkerOptions.getAnchorV()); markerOptions.draggable(customMarkerOptions.isDraggable()); markerOptions.visible(customMarkerOptions.isVisible()); markerOptions.zIndex(customMarkerOptions.getZIndex()); } Marker marker = addLatLngToMap(map, latLng, markerOptions); markers.add(marker); } return markers; }
Example 5
Source File: MainActivity.java From xposed-gps with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); settings = new Settings(getApplicationContext()); FragmentManager fm = getFragmentManager(); Fragment frag = fm.findFragmentById(R.id.map); if (frag instanceof MapFragment) { MapFragment mapf = (MapFragment) frag; mMap = (GoogleMap) mapf.getMap(); mMap.setOnCameraChangeListener(this); mMarker = new MarkerOptions(); mInit = new LatLng(settings.getLat(), settings.getLng()); mMarker.position(mInit); mMarker.draggable(true); CameraUpdate cam = CameraUpdateFactory.newLatLng(mInit); mMap.moveCamera(cam); mMap.addMarker(mMarker); } Button set = (Button) findViewById(R.id.set_location); set.setOnClickListener(this); Button start = (Button) findViewById(R.id.start); start.setOnClickListener(this); Button sel = (Button) findViewById(R.id.select_apps); sel.setOnClickListener(this); start.setText(settings.isStarted() ? getString(R.string.stop) : getString(R.string.start)); }