【问题标题】:adding map in xml slow down the app在 xml 中添加地图会降低应用程序的速度
【发布时间】:2012-11-01 17:02:34
【问题描述】:

只要我将地图添加到我的布局 XML 中,活动的加载速度就会非常慢。时间长了会跳转到activity并显示地图。我对此很陌生,任何帮助都会很好。

我发现一个网页链接说我应该尝试延迟加载。我理解它,因为它会先进入活动然后加载地图。但我不确定如何实现这一点。

谁能举个例子?

<com.google.android.maps.MapView
             android:id="@+id/location_map"
             android:layout_toRightOf="@id/rl_personaltrip_departure_times"
             android:layout_width="fill_parent"
             android:layout_height="200dp"
             android:layout_marginLeft="10dp"
             android:layout_marginRight="10dp"
             android:enabled="true"
             android:clickable="true"
             android:apiKey="@string/maps_api_key"
      />

【问题讨论】:

    标签: android


    【解决方案1】:

    只需在下面写下这段代码

    mapView = (MapView) findViewById(R.id.mapView);
            mapView.preLoad();
    

    【讨论】:

    • k.如果有任何疑问,请通过以下链接与我联系 chat.stackoverflow.com/rooms/18781/room-for-ckpatel
    猜你喜欢
    • 2012-10-24
    • 1970-01-01
    • 1970-01-01
    • 2022-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-15
    相关资源
    最近更新 更多