Wednesday, March 14, 2012

Always show zoom controls on a MapView in Android

 Always show zoom controls on a MapView in android.
problem:
i want show zoom controls on a Mapview always.
Solution:
 below  the code for get zoom controls always in mapview 2 way.
         mapView = (MapView) findViewById(R.id.mapview);
          mapView.setBuiltInZoomControls(true);
          mapView.getZoomButtonsController().setAutoDismissed(false);
                            
or

<ZoomControls android:id="@+id/zoomcontrols" android:layout_width="wrap_content" android:layout_height="wrap_content" />    
 ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols);      zoomControls.setOnZoomInClickListener(new View.OnClickListener() {             
 @Override                  
public void onClick(View v) {                         
 mapController.zoomIn();               
  }        
 });        
 zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {              
@Override               
  public void onClick(View v) {                        
 mapController.zoomOut();                
 }       
  });  

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...