如何获取在android中加载mapview的进度状态?

时间:2010-02-18 12:22:17

标签: android android-emulator android-mapview

当地图处于加载状态时,我想将进度条放在mapview的中心。

如何取得进步?怎么办?

给我一​​些例子..

感谢。

2 个答案:

答案 0 :(得分:1)

我认为没有任何合理的方法。请注意,Google并未在其地图应用程序中执行此操作。很明显只是查看页面是否仍在加载,所以我认为实际上没有必要放入进度指示器。

MapView有一个方法canCoverCenter(),它可以告诉您中心磁贴是否可用,但其余磁贴没有任何内容。

答案 1 :(得分:0)

查看 GoogleMap.OnMapLoadedCallback

  

地图完成渲染后的回调界面。这个   在获取渲染地图所需的所有图块之后发生,   并且所有标签都已完成。如果地图不会触发此事件   永远不会因连接问题而加载,或者地图是连续的   由于用户不断变化而永远不会完成加载   与地图互动。

用法示例:

/**
 * Acquire a non-null instance of the GoogleMap.
 */
mMapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(GoogleMap googleMap) {
        googleMap.setOnMapLoadedCallback(new OnMapLoadedCallback() {
            /**
             * Called when the map has finished rendering.
             * This will only be called once.
             * You must request another callback if you want to be notified again.
             */
            @Override
            public void onMapLoaded() {
                //TODO: Hide ProgressBar
            }
        });
    }
});
相关问题