Android的MapView类 - 自定义的变焦按钮 [英] Android MapView - custom Zoom buttons
问题描述
你知道,如果有一种方法如何使自定义缩放按钮,Android的图形页面?或者只有pre $ P $美嘉缩放控制?
do you know, if there is a way how to make custom zoom buttons in Android's mapView? Or there are only prepreared zoom controls?
感谢
Hmyzak
推荐答案
您可以设置默认缩放控件为假( mapView.setBuiltInZoomControls(假)
),添加一些被绘制在地图之上,并有每个按钮按钮有当他们是pressed的监听器。的MapView允许您设置缩放级别。其中一个按钮可以做一个 mapView.getController()。zoomOut()
,其他的可以做一个 mapView.getController()。zoomIn()
。如果由于某种原因,你需要找到缩放级别,你可以做一个 mapView.getController()。getZoomLevel()
。最大变焦等级可以通过使用 mapView.getController()被发现。getMaxZoomLevel()
。在我的经验,这个值为21。
You can set the default zoom controls to false (mapView.setBuiltInZoomControls(false)
), add some buttons that are drawn on top of the map and have each button have a listener for when they are pressed. The MapView allows you to set the zoom level. One of the buttons could do a mapView.getController().zoomOut()
, the other could do a mapView.getController().zoomIn()
. If for some reason you need to find the zoom level, you can do a mapView.getController().getZoomLevel()
. The maximum zoom level can be found by using mapView.getController().getMaxZoomLevel()
. In my experiences, this value was 21.
<一个href=\"http://$c$c.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapView.html\">Here是其谷歌code页面上的MapView文档的页面。
<一个href=\"https://developers.google.com/maps/documentation/android/reference/com/google/android/maps/MapController\">Here你可以阅读的MapController 文档
编辑:
更新的解决方案使用zoomIn和zoomOut
Updated solution to use zoomIn and zoomOut
这篇关于Android的MapView类 - 自定义的变焦按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!