繁体   English   中英

如何在Android Google Maps API v2中创建迷你地图?

[英]How to create a Mini Map in Android Google Maps API v2?

我想在GoogleMap上使用一种“迷你地图”。 最低要求是创建标记和动态更改缩放(两者)。 有没有比用两个片段创建两个GoogleMaps更简单的方法?

我认为同时使用两个GoogleMap会降低性能,但我还没有尝试过。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >


    <fragment
        android:id="@+id/miniMap"
        android:name="com.example.presentation.views.MainActivity"
        android:layout_width="300dp"
        android:layout_height="300dp"
        class="com.google.android.gms.maps.MapFragment" />
    <fragment
        android:id="@+id/bigMap"
        android:name="com.example.presentation.views.MainActivity"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        class="com.google.android.gms.maps.MapFragment" />


</RelativeLayout>

Google Play服务的示例应用程序一起提供了4张地图。 您可以在Android-sdk下找到它:

〜\\ android-sdk \\ extras \\ google \\ google_play_services \\ samples \\ maps \\ src \\ com \\ example \\ mapdemo \\ MultiMapDemoAtivity.java

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM