Android地图图书馆V2变焦控制自定义位置 [英] Android Maps Library V2 zoom controls custom position

查看:117
本文介绍了Android地图图书馆V2变焦控制自定义位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么可以自定义在GoogleMap的V2内置的缩放控件的位置?

How can i customize the position of the builtin zoom controls in a GoogleMap V2 ?

有很多与此相关的话题,谷歌地图库的版本1的问题。

There are a lot of questions related to this topic for the Version 1 of Google Maps library.

配售缩放控件在图形页面

<一个href="http://stackoverflow.com/questions/4035347/how-to-reposition-built-in-zoom-controls-in-mapview">How重新定位内置变焦控制在图形页面?

<一个href="http://stackoverflow.com/questions/1768097/how-to-layout-zoom-control-with-setbuiltinzoomcontrolstrue">How布局变焦控制setBuiltInZoomControls(真)?

不过,我没能找到有关的任何问题,图书馆的V2。

However, i wasn't able to find any questions in relation to the V2 of the library.

在V2,有没有一种方法

In the V2, there's no method

(LinearLayout) mapView.getZoomControls();

所有的previously提到的问题变得过时了。

all the previously mentioned questions becomes obsolete.

在此先感谢

推荐答案

根据你想要做什么,你可能会发现新添加的<一个href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap#setPadding%28int,%20int,%20int,%20int%29">GoogleMap.setPadding()方法是有用的。

Depending on what you're trying to do, you might find the newly-added GoogleMap.setPadding() method useful.

map.setPadding(leftPadding, topPadding, rightPadding, bottomPadding);

从API文档:

From the API docs:

此方法,可以在地图上定义一个可见区,以信号通知周围的边缘地图的部分可以被遮蔽,通过在每个地图的四个边缘设置填充地图。地图功能将被适应于填充。例如,缩放控件,指南针,版权声明和谷歌的标志将被移动到适合定义的区域内,镜头运动将相对于中心可见光区等。

This method allows you to define a visible region on the map, to signal to the map that portions of the map around the edges may be obscured, by setting padding on each of the four edges of the map. Map functions will be adapted to the padding. For example, the zoom controls, compass, copyright notices and Google logo will be moved to fit inside the defined region, camera movements will be relative to the center of the visible region, etc.

另请参阅如何填充工作在GoogleMap的的描述。

Also see the description of how padding works in GoogleMap.

这篇关于Android地图图书馆V2变焦控制自定义位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆