Reputation: 95
[SOLVED] I added this to MainActivity XML file:
<FrameLayout
android:id="@+id/place_map_here"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
<FrameLayout
android:id="@+id/bugfixview"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@android:color/transparent"/>
and where I changed the fragments:
mapFragment = new FragmentMapView();
android.app.FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.add(R.id.place_map_here, mapFragment, "map");
ft.commit();
Edit: Just realized that I do not use the MapFragment xml file.(older build did sorry)
I´ve changed my Fragment to a MapFragment and now my NavigationDrawer slides in behind the MapFragment :( Code:
MapFragmant xml ( removed code)
MainActivity xml. Here is my drawer declared
<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"
tools:context=".MainActivity" >
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<FrameLayout
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<ListView
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#333"
android:choiceMode="singleChoice"/>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
I hope this is the information you need to be awesome like always and help noobs like me :)
Upvotes: 2
Views: 1284
Reputation: 1
we can solve NavigationDrawer going behind MapFragment by using view just below map fragment in the layout.
eg -
<FrameLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent" />
Upvotes: 0
Reputation: 11915
Try this hack it might help you, just change your layout to something like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- hack to fix ugly black Background with maps v2 -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent" />
</FrameLayout>
</LinearLayout>
Upvotes: 1
Reputation: 5093
DrawerLayout needs to be the root of your layout, so try deleting the RelativeLayout. I assume you are attaching your MapFragment to the FrameLayout, main.
Also, what api version are you on? I've noticed some weird graphics bugs on api<10 including black borders and black flashing backgrounds with both map fragments and drawers.
Upvotes: 0