MapView couldn't drag&drop when Zoom Controller is displ

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

MapView couldn't drag&drop when Zoom Controller is displ

Postby thl16888 » Tue Dec 30, 2008 3:41 pm

Hi all
In my map application I couldn't drag&drop the MapView when Zoom
Controller is displayed. But I found SDK's maps application can do it.
Would you like to let me know how to implement it in my code? Thank
you very much.
thl16888
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Nov 04, 2008 2:18 pm

Top

Postby ndroid » Mon Jan 05, 2009 8:27 am

i know another method..
you can use the onTouchEvent method to get the amount of drag and then use scrollby to scroll the map..
regards
ravi
ndroid
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Dec 15, 2008 1:29 pm

Postby thl16888 » Tue Jan 06, 2009 2:08 am

I got it.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.    
  2.  
  3. // The Zoom Controls will be displayed on bottom center.
  4.  
  5.     void showZoomControls()
  6.  
  7.     {
  8.  
  9.         // Please use relativelayout in googlemaps.xml, otherwise zoom controller can't be gotten displayed.
  10.  
  11.         LinearLayout zoomLayout = (LinearLayout) findViewById(R.id.map_zoom);
  12.  
  13.         zoomLayout.addView(mMapView.getZoomControls(),
  14.  
  15.                         new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT,
  16.  
  17.                         LayoutParams.WRAP_CONTENT));
  18.  
  19.        
  20.  
  21.         // Please do not use following codes to display zoom controller;
  22.  
  23.         // otherwise, drag & drop will be gotten no response when the zoom
  24.  
  25.         // controller is displayed.
  26.  
  27.        
  28.  
  29.         // Zoom View
  30.  
  31.         //LinearLayout zoomView = (LinearLayout) mMapView.getZoomControls();
  32.  
  33.         //zoomView.setLayoutParams( new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT,
  34.  
  35.         //              LayoutParams.WRAP_CONTENT ));
  36.  
  37.         //zoomView.setGravity(Gravity.BOTTOM + Gravity.CENTER_HORIZONTAL);
  38.  
  39.         //mMapView.addView(zoomView);
  40.  
  41.         //mMapView.displayZoomControls(true);
  42.  
  43.     }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4
thl16888
Junior Developer
Junior Developer
 
Posts: 11
Joined: Tue Nov 04, 2008 2:18 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 5 guests