【问题标题】:How to use LatLngBounds?如何使用 LatLngBounds?
【发布时间】:2016-11-29 21:20:05
【问题描述】:

我正在为我们的移动应用程序开发主题制定最终要求,并且我正在使用 gmaps,确切地说是室内地图。我在研究如何将我的自定义地图放入谷歌地图时。我遇到了 LatLngBounds。在不知道 LatLng 顶部、底部、左侧和右侧值的情况下如何使用它?

【问题讨论】:

    标签: android google-maps


    【解决方案1】:

    您不需要知道顶部、底部、左侧和右侧。 您只需确定两个 LatLang 并将相机绑定到它们,如下所示

     LatLng pickupLatLng = new LatLng(xx.xxxxxx, xx.xxxxxx);
     LatLng destinationLatLng = new LatLng(xx.xxxxxx, xx.xxxxxx);
     LatLngBounds bounds = LatLngBounds.builder().include(pickupLatLng).include(destinationLatLng).build();
     map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, getResources().getDimensionPixelSize(R.dimen.map_camera_padding_new_bounds)));
    

    【讨论】:

    • 我也忘了提一下,我过度使用地面将我的自定义地图放到谷歌地图上。这段代码可以工作吗?
    猜你喜欢
    • 2018-12-22
    • 1970-01-01
    • 1970-01-01
    • 2012-05-24
    • 1970-01-01
    • 1970-01-01
    • 2011-08-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多