开发者

How to rotate the zoom control on a mapview to vertical in android

I have a map, in that map i have placed a zoomcontrol like this

    View zoomView = mapView.getZoomControls(); 
    zoomLayout.addView(zoomView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
    mapView.displayZoomControls(true);

In xml it is used like this

<LinearLayout 
    android:id="@+id/layo开发者_如何学Cut_zoom"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true"
    android:layout_gravity="center_horizontal"/> 
</LinearLayout>

Now i need to rotate this zoom in vertical format... how to do it?


Best thing to do is create a vertical linear layout with 2 image button elements(one for zoom in and one for zoom out), you will have to create your own images if you want them to look like the android ones, then just call mapView.getController().zoomIn() or zoomOut().


With the new API you can zoom controlling the camera:

googleMap.animateCamera(
    CameraUpdateFactory.newLatLngZoom(
    cluster.getPosition(), 
    (float) Math.floor(googleMap.getCameraPosition().zoom + 1)), 
    300, 
   null);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜