0
我有一個活動和4片段如下。地圖片段顯示另一個錯誤的地圖片段(一個從後面的堆棧)它上面
片段A打開片段B(在其中包含映射片段以及其他組件)。
片段B打開C片段
C片段打開片段d(其內部具有地圖碎片以及其他成分)
有什麼奇怪的是,我看到的片段d地圖,從片段中的其他地圖B在它上面。
<!-- Fragment B -->
<LinearLayout ....
<fragment
android:id="@+id/put_ad_google_map1"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/continue_button"
android:layout_alignParentTop="true"
/>
<!-- Fragment D -->
<LinearLayout ....
<fragment
android:id="@+id/put_ad_google_map2"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_above="@+id/continue_button"
android:layout_alignParentTop="true"
/>
任何線索可能是什麼問題?
感謝您的評論。不幸的是我需要將這兩個碎片放在一起。我有地圖與標記,當標記點擊時,我打開另一個內部地圖的詳細片段。當我點擊後,我應該看到原來的片段狀態。 – MSaudi
如果您需要兩個片段,請考慮'add map fragment back',並將標記保存在'bundle或SQLite'中或保存在文件中 – bjiang
是的,這是我想到的經典解決方案。問題在於它會讓應用程序變慢,因爲我有大量的標記。再次感謝 – MSaudi