Issue
I have a problem where the status bar will not turn translucent. The translucent status bar and navigation bar code works fine by itself, however, when I implement the Google Maps Fragment into the activity view, the translucent bar turns gray. I have tested this with a fully transparent status bar but which again works at first, then has a white background once maps is added. It seems as if Google Maps has some sort of overlay. Any help is appreciated to get status bar to be translucent with Google Maps API.
XML File
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.mapwithmarker.MapsMarkerActivity"
tools:layout="@layout/activity_main" />
</android.support.v4.widget.DrawerLayout>
Translucent status bar
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
Solution
I have found the solution. Set android:fitsSystemWindows
in DrawerLayout to "false"
, if anyone is adding a map to drawer layout.
Answered By - Lord Goderick
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.