Android Google Map in FragmentDialog being overlayed by the Dialog's own gray overlay -
i migrated mapview activity's layout dialogfragment. pretty painless migration:
a button on activity launches dialog, setting latlng
map requires:
case r.id.btn_open_map: android.support.v4.app.fragmentmanager fragmentmanager = getsupportfragmentmanager(); directionsmapdialogfragment mapdialogfragment = new directionsmapdialogfragment(); mapdialogfragment.setlatlng(mlatlng); mapdialogfragment.setretaininstance(false); mapdialogfragment.show(fragmentmanager, "fragmentname"); break;
in fragment it's pretty standard code. use custom layout, have button overlaying map launches googlemaps app:
<framelayout 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" android:clickable="true" tools:context="com.alexrafa.meetmi.fragments.directionsmapfragment" android:background="@android:color/transparent"> <com.google.android.gms.maps.mapview android:id="@+id/mv_location_map" android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true" android:apikey="apikey" /> <imagebutton android:layout_width="39dp" android:layout_height="39dp" android:src="@drawable/ic_directions_grey600_24dp" android:id="@+id/btn_directions" android:background="@drawable/background_map_button" android:layout_gravity="top|center|right" android:layout_marginright="11dp" android:layout_margintop="60dp" android:contentdescription="@string/btn_get_map_directions" /> </framelayout>
notice how tried setting background transparent in framelayout
. did because seems map overlayed standard gray overlay dialogs have in android:
and it's not api auth problem, map's functions work perfectly. how can fix this?
so how ended fixing little predicament:
set theme dialog, mapdialogfragment.setstyle(dialogfragment.style_normal, android.r.style.theme_light_panel);
, added top , bottom padding in layout. result:
big saurabh1489 helping me find answer!
Comments
Post a Comment