laobie / StatusBarUtil

A util for setting status bar style on Android App.
http://t.cn/Rq746Kb
Apache License 2.0
8.82k stars 1.72k forks source link

toolbar被覆盖了statusbar的位置 #12

Closed BelongsH closed 8 years ago

BelongsH commented 8 years ago

出现的问题:toolbar被覆盖了statusbar的位置,米3, Sys:6.1

xml:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dl_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="#ccffee" />

        <FrameLayout
            android:id="@+id/fl_main_content"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/ll_main_menu_parent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start">

        <FrameLayout
            android:id="@+id/fl_main_menu"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>

</android.support.v4.widget.DrawerLayout>

java: @Override public void setStatusBar() { StatusBarUtils.setTranslucentForDrawerLayout(this, dl_main, 0); }

laobie commented 8 years ago

等我这几天有空测试下,如果修复了这个bug我会通知你的 : )

Aysnine commented 8 years ago

不知道是不是同样的问题,应该说是content没有给 StatusBar 腾出位置。

软件 StatusBarUtil.apk 正常,不知道是代码哪里的问题。

小魅蓝,FlymeOS 4.2.1.2C,Android 4.4.4

laobie commented 8 years ago

@Aysnine ok,我测试下给你答复

laobie commented 8 years ago

@BelongsH 用你的布局测试了下,你这个界面不应该调用设置透明这个方法,应该调用 setColorForDrawerLayout 就没问题的。 当你的toolbar使用图片作背景的话,设置透明的话是有问题的。这个我还在修复中。 image

laobie commented 8 years ago

@Aysnine 你看看你是不是也是这个问题

Aysnine commented 8 years ago

@laobie 可行,StatusBar 的位置出现,但是颜色不对,设置的和 Toolbar 一样的颜色,但是变色了,偏紫。

侧滑出的 Drawer 没问题,上方正常透明。

捉急,原谅我上不了图|・ω・`)

laobie commented 8 years ago

@Aysnine 那个不是偏紫色,那个是一个透明度遮罩,如果是纯色不加遮罩的话你可以用另外一个方法,你看我给你的截图,或者看源码有注释的。 image

按照你的需求,你需要的是第二个方法setColorNoTranslucentForDrawerLayout

Aysnine commented 8 years ago

@laobie 真•偏紫,试过 NoTranslucent ,Serious,浅蓝加遮罩会紫?不信你看看 gmail (:з」∠)