2014-04-11 16 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