1

我有一个相当简单的布局:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.mapbox.mapboxsdk.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin" />

 </FrameLayout>

我希望地图出现在完全透明的系统栏(导航栏和状态栏)下。为了实现这一点,我将状态和导航栏颜色设置为android:color/transparent

<style name="Theme.Lab.Map">
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:navigationBarColor">@android:color/transparent</item>
    <item name="android:fitsSystemWindows">false</item>
</style>

但很遗憾,地图没有出现在系统栏下。相反,默认活动背景颜色是可见的。
我设置fitSystemWindows为 false 因为当我设置android:translucentStatusBartrue. 问题translucentStatusBar是,状态栏只是半透明的,不像我想要的那样完全透明。
我必须以某种方式告诉地图 - 或活动 - 它可以在系统栏下方展开。

编辑

也可以使用translucentStatusBar但更改状态栏的透明度/不透明度。我只是没有找到办法做到这一点。

4

0 回答 0