2014-04-11 15 views
1

我在一家RelativeLayout顯示GoogleMap,具有TextView(除其他事項外)結束:Android的GoogleMap的重疊次數的onResume

<RelativeLayout 
    width=match_parent 
    height=match_parent> 
    <Map 
     width=match_parent 
     height=match_parent /> 
    <TextView 
     with=100dp 
     height=100dp /> 
</RelativeLayout> 

出於某種原因,如果我打回家,然後重新打開該應用程序時,地圖將會覆蓋(覆蓋)TextView

我試圖使用SupportMapFragmentMapView(與zOrderOnTop="false"),但沒有效果。 我也試圖在onResume/上顯示/隱藏地圖,沒效果。

我也有Drawer issue,但建議的修復只解決了Drawer問題。

版本: com.google.android.gms:play-services:4.2.+ compileSdkVersion 19 minSdkVersion 14 targetSdkVersion 14

注意:此問題僅發生在Samsung Galaxy SII(4.0.4)上。 有什麼想法?謝謝。

更新:我也試圖從膨脹的代碼,而不是XML的Fragment,或使用GoogleMapOptions設置zOrderOnTop(false),還是同樣的結果...

更新2:我想我收窄問題:

工作:

drawer.xml

<Drawer> 
    <RelativeLayout 
     width=match_parent 
     height=match_parent> 
     <RelativeLayout 
      width=match_parent 
      height=match_parent> 
      <Map 
       width=match_parent 
       height=match_parent> 
      <View 
       width=match_parent 
       height=match_parent 
       background=transparent> 
     </RelativeLayout> 

     <TextView 
      width=100dp 
      height=100dp> 
    </RelativeLayout> 

    <ListView /> <!-- menu --> 
</Drawer> 

不工作:

drawer.xml

<Drawer> 
    <FrameLayout /> <!-- fragment container --> 

    <ListView /> <!-- menu --> 
</Drawer> 

map.xml

<RelativeLayout 
    width=match_parent 
    height=match_parent> 
    <RelativeLayout 
     width=match_parent 
     height=match_parent> 
     <Map 
      width=match_parent 
      height=match_parent> 
     <View 
      width=match_parent 
      height=match_parent 
      background=transparent> 
    </RelativeLayout> 

    <TextView 
     width=100dp 
     height=100dp> 
</RelativeLayout> 

一個解決辦法是要在地圖中drawer.xml聲明,然後用setVisibility顯示/隱藏在需要的時候...有什麼更好的建議?

回答

0

你應該嘗試:

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_width="match_parent"> 

    <!-- Extra hack ViewGroup to fix Map z-ordering --> 
    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <Map 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@android:color/transparent"/> 

    </RelativeLayout> 

    <TextView 
     with=100dp 
     height=100dp /> 

</RelativeLayout> 

至少對我來說,這是足以解決與z順序問題。我相信這個問題隻影響Jellybean之前的設備,這就解釋了爲什麼你在SII上看到它。

+0

謝謝,但我已經嘗試過。它只修復抽屜問題,而不是主要問題...... – mbmc