android-maps-v2

Don't snap to marker after click in android map v2

被刻印的时光 ゝ 提交于 2019-11-30 06:45:47
问题 Currently Android Map v2 snaps to marker location after click. I want to disable this behavior but see no options to do it. Does anybody know how to fix that? 回答1: Based on what I read from the Markers - Google Maps Android API (https://developers.google.com/maps/documentation/android/marker#marker_click_events) Marker click events You can use an OnMarkerClickListener to listen for click events on the marker. To set this listener on the map, call GoogleMap.setOnMarkerClickListener

Drawing multi color PolyLines on Maps V2

╄→гoц情女王★ 提交于 2019-11-30 05:17:33
I am drawing a plain color PolyLine on my map the following way, and it works great: PolylineOptions polyLine = new PolylineOptions(); polyLine.width(5); polyLine.color(Color.RED); polyLine.geodesic(true); for (int i = 0; i < speed.length; i++) { polyLine.add(new LatLng(lat, lng)); } map.addPolyline(polyLine); Now I would want to draw a polyline with different colors between different points, depending on the speed between those two points. There doesn't seem to be an easy way of doing it. I am referring to this question : draw polylines with different colors on v2 maps , and I can add

Google Maps v2 lag after popping their fragment back from stack

送分小仙女□ 提交于 2019-11-30 04:31:31
问题 I have an Activity with a MapFragment that I add to the Activity programmatically using a FragmentTransaction : private static final String MAP_FRAGMENT_TAG = "map"; private MapFragment mapFragment = null; ... protected void onCreate(Bundle savedInstanceState) { ... mapFragment = (MapFragment) getFragmentManager().findFragmentByTag(MAP_FRAGMENT_TAG); if (mapFragment == null) { mapFragment = MapFragment.newInstance(); FragmentTransaction fragmentTransaction = getFragmentManager()

setContentView() slow with map fragment

╄→尐↘猪︶ㄣ 提交于 2019-11-30 03:48:59
I am working on an app that shows a google map (api v2) as a fragment. When the app loads it shows a blank white screen for a couple of seconds before showing the map. I have used log statements see where the delays is but I don't know why it's so slow. Here is my onCreate: @Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "onCreate Start -------------------------------"); super.onCreate(savedInstanceState); Log.i(TAG, "onCreate 1 -------------------------------"); setContentView(R.layout.activity_main); Log.i(TAG, "onCreate 2 -------------------------------"); do_async

How to get Bitmap of MapView from Android Google Maps API V2

末鹿安然 提交于 2019-11-30 03:10:58
问题 I'm updating my app to the new Android Maps API V2 and ran into a problem when trying to get a bitmap image of the currently shown map. In API V1 I did this like so: Bitmap mBitmap; MapViwe mMapView; // ... mBitmap = Bitmap.createBitmap(MAP_WIDTH, MAP_HEIGHT, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(mBitmap); mMapView.draw(canvas); Whilest in API V1, this got me a bitmap of the map, in API V2, all I get is a black rectangle. Also with API V2 I'm using the MapView , not the

Null pointer exception at mapFragment.getMapAsync(this) while initializing google map

穿精又带淫゛_ 提交于 2019-11-30 02:58:52
问题 When I use v6.5.87 of Google Play Services, I get a null pointer exception when I call getMapAsync() . I'm using a SupportMapFragment in my Fragment 's xml layout. My code: SupportMapFragment mapFragment = (SupportMapFragment) getActivity() .getSupportFragmentManager().findFragmentById(R.id.mapFragment); mapFragment.getMapAsync(this); Note: There's no problem when calling getMap() on older Google Play Services versions, but getMap() is now deprecated (docs). Here's the stack trace for the NPE

Set Image from drawable as marker in Google Map version 2

吃可爱长大的小学妹 提交于 2019-11-29 22:04:51
I am using this part of code to add a marker in a MapFragment in Google Map Version 2. MarkerOptions op = new MarkerOptions(); op.position(point) .title(Location_ArrayList.get(j).getCity_name()) .snippet(Location_ArrayList.get(j).getVenue_name()) .draggable(true); m = map.addMarker(op); markers.add(m); I want to use different images from my drawable. Muhammad Babar This is how you can set a Drawable as a Marker . BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.current_position_tennis_ball) MarkerOptions markerOptions = new MarkerOptions().position(latLng) .title(

Android google maps marker disable navigation option

六眼飞鱼酱① 提交于 2019-11-29 20:33:07
Im creating an app where users need to walk to a point on a map. But they need to find a route to the point by them selves. Ive created a map with markers but by default if a user clicks on the marker a "start navigation" and "view in google maps" option is shown. Is it possible to disable these options ? The options that are shown on marker click This thing is called Map Toolbar . You can disable it by calling UiSettings.setMapToolbarEnabled(false) : GoogleMap map; ....... //init map map.getUiSettings().setMapToolbarEnabled(false); You can also define setMapToolbarEnabled() from the XML using

MapView inside NestedScrollView not scrolling

六月ゝ 毕业季﹏ 提交于 2019-11-29 20:24:44
问题 Inflating my Mapview in xml like this <android.support.v4.widget.NestedScrollView android:id="@+id/sv_offers" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="56dp" android:visibility="gone" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.xys.widgets.CustomMapView android:id="@+id/mapView" android:layout_width=

Display Multiple pin on same LAT/LONG values

孤人 提交于 2019-11-29 15:24:18
I'm trying to show pins on mapv2 of same lat/long values, but the pins are getting overlapped on one another. Id there any better way to display multiple pins at same lat/long when i have to display bunch of pins at the same location (Lat/Long). Use anchor(float u, float v) of MarkerOptions() to set different anchor for each Marker No, it is not possible, because just think in a common way, you have one latitude and longitude, means one point to put pin, so if you are push 1000 pins there then you can only see one only, because there is one predefined as well as perfect point. Its not possible