Status bar turns white and does not show content behind it

前端 未结 26 2605
闹比i
闹比i 2020-11-29 22:33

I am trying out AppCompat on Marshmallow. And I want to have a transparent status bar however it turns white. I\'ve tried a couple solutions but they didn\'t work for me (Tr

26条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 23:30

    For me it worked by doing the following :

    1. Set the theme .NoActionBar
    2. Wrap the Toolbar in android.support.design.widget.AppBarLayout
    3. Make android.support.design.widget.CoordinatorLayout as the parent layout.

    Essentially it is the third step that draws the status bar in the colorPrimaryDark otherwise it is not drawn if you using NoActionBar theme. 2nd step will give your toolbar that overlay.

提交回复
热议问题