【发布时间】:2017-06-01 12:07:38
【问题描述】:
我有一个问题,状态栏不会变成半透明。半透明状态栏和导航栏代码本身可以正常工作,但是,当我将 Google Maps Fragment 实施到活动视图中时,半透明栏变成灰色。我已经用一个完全透明的状态栏对此进行了测试,但它首先再次起作用,然后在添加地图后具有白色背景。似乎谷歌地图有某种覆盖。感谢任何帮助,以使状态栏使用 Google Maps API 变为半透明。
XML 文件
<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>
半透明状态栏
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
【问题讨论】:
标签: java android google-maps-android-api-2 android-xml android-statusbar