I'm displaying a GoogleMap
in a RelativeLayout
, with a TextView
(among other things) over:
<RelativeLayout
width=match_parent
height=match_parent>
<Map
width=match_parent
height=match_parent />
<TextView
with=100dp
height=100dp />
</RelativeLayout>
For some reason, if I hit home, then reopen the app, the Map will be over (covering) the TextView
.
I tried to use SupportMapFragment
, and MapView
(with zOrderOnTop="false"
) but no effect.
I also tried to show / hide the Map in onResume
/ onPause
, no effect.
I also had the Drawer
issue, but the suggested fix only solved the Drawer
problem.
Versions:
com.google.android.gms:play-services:4.2.+
compileSdkVersion 19
minSdkVersion 14
targetSdkVersion 14
.
Note: this problem only occurs on Samsung Galaxy SII (4.0.4). Any idea? Thanks.
Update: I also tried to inflate the Fragment
from the code instead of XML, or use GoogleMapOptions
to set zOrderOnTop(false)
, still same result...
Update 2: I think I narrowed down the problem:
Working:
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>
Not working:
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>
One solution would be to have the Map declared in drawer.xml, then use setVisibility
to show / hide it when needed... Any better suggestion?