android-mapview

Disable moving around in mapview

泄露秘密 提交于 2019-11-29 05:36:25
Is it possible to disable moving inside the google map? Aalap Even though there is an accepted answer, just providing my answer as it didnt help me. mapView.setClickable(false) does not work all the time, like cases where you have a mapView inside a scrollView. So I created a view object right above the mapView of the same size. Handled the onTouchListener for my overlay view and passed all the touch events to the parent of mapView (ScrollView in my case), hence by-passing all the touch events from mapView to scrollview. One more way to achieve is by doing mMap.getUiSettings()

Android custom control to display map tiles [closed]

谁说我不能喝 提交于 2019-11-29 05:19:04
I have on my server map tiles sorted on a folder structure like OpenStreetMap (OSM) uses. I need to be able to display these tiles, zoom in/out, pan and rotate the map. I wouldn't start from the scratch to create a new control. I've seen OsmDroid but I didn't find a way to set my own non vectorized tile source. I am open to any suggestions. I would first try to check out their source code to get an understanding of how they did it. Here is the link to their source codes. To be more precise I think that this is the file you are looking for. 来源: https://stackoverflow.com/questions/4793290

MapView Marker shadow

梦想与她 提交于 2019-11-29 05:14:22
I am adding different markers to my map... Drawable drawable = app1.getResources().getDrawable(R.drawable.test); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); OverlayItem overlayitem2 = new OverlayItem(mark, "Test", "t"); overlayitem2.setMarker(drawable); app1.mapOverlay.addOverlay(overlayitem2); app1.mapOverlays.add(app1.mapOverlay); that works but the shadow is at the wrong position. I use this: int w = drawable.getIntrinsicWidth(); int h = drawable.getIntrinsicHeight(); drawable.setBounds(-w / 2, -h, w / 2, 0); I know this has been answered a while

Android Map Zoom to Show all Pins

自作多情 提交于 2019-11-29 05:04:10
问题 I have 5 pins added to a map. How can I tell the MapView to zoom as much as possible and keep all pins in view? 回答1: I used this method in a recent project of mine public void centerOverlays() { int minLat = 81 * MapStoresController.MAP_SCALE; int maxLat = -81 * MapStoresController.MAP_SCALE; int minLon = 181 * MapStoresController.MAP_SCALE; int maxLon = -181 * MapStoresController.MAP_SCALE; for (int i = 0; i < overlayItems.size(); i++) { Store s = overlayItems.getItem(i).getStore(); minLat =

OnTouch in MapView only fires the first time

这一生的挚爱 提交于 2019-11-29 04:39:33
I'm trying to implement a double-tap zoom like function in my MapView. The event always fires the first time, but never subsequent times. Below is my code. I have a feeling it has something to do with the map controller getting lost after the first time the event is fired. import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; public class mainmap extends MapActivity implements OnTouchListener{

MapView inside Fragment - specified child already has a parent

柔情痞子 提交于 2019-11-29 03:59:05
I'm trying to show a MapView inside a fragment (using the hacked compatibility library). The following has worked just fine in the past: fragment's onCreateView() simply returns a new FrameLayout fragment's onActivityCreated() gets the MapView from the Acitivity and adds it to its view hierarchy onDestroyView() removes the MapView from its view hierarchy Now I would like the fragment to use a layout defined in xml so that I can have some other UI stuff. Putting the MapView element in the layout file always crashes, so I'm doing it this way: map_screen_fragment.xml <?xml version="1.0" encoding=

Drawing multi color PolyLines on Maps V2

这一生的挚爱 提交于 2019-11-29 03:08:45
问题 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

How to draw line on Map View given coordinates?

拜拜、爱过 提交于 2019-11-29 02:30:15
How to draw line on MapView given coordinates? AFAIK, on iPhone it is possible. Please advise. Thanks in advance. To use a MapView your Activity must extend MapActivity . For each line you want to draw (or really anything else) you need to subclass Overlay and do the drawing in the Overlay 's onDraw() method. Once you've created your Overlay add it to the MapView with something like mMapView.getOverlays().add(new MyOverlay()); . Inside your custom Overlay you'll want to get a Projection with something like Projection p = mapView.getProjection(); . From the Projection you can convert GPS

How to use Android ViewSwitcher?

谁说胖子不能爱 提交于 2019-11-29 02:07:49
I'm trying to use the ViewSwitcher to perform switches between two views. One is an ImageView and the other is a MapView. I have a button which the user clicks to perform this switch but my codes are causing an error. Do you guys have any idea what's about? <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <relativelayout android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content">

Moving icons on a Android MapView

拟墨画扇 提交于 2019-11-29 01:35:56
问题 I'm working on an application that displays the location of moving items on a Google MapView. I need a way to update the position of the icons that represent the items (as well as change the facing of the icons every two seconds as updated data comes in). I currently have an activity in the app that extends MapActivity. On to this I have overlaid a static Overlay that draws some lines on the map and an ItemizedOverlay that draws a static icon. There is a draw() method that claims to be used