首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >安卓NavigationView (物料支持库)与状态栏交互不正常

安卓NavigationView (物料支持库)与状态栏交互不正常
EN

Stack Overflow用户
提问于 2015-05-30 06:13:28
回答 3查看 3.4K关注 0票数 17

我正在按照here的例子将新的Material Design Support库的NavigationView集成到我的应用程序中。

我的总体布局如下所示:

activity.xml

代码语言:javascript
复制
<android.support.v4.widget.DrawerLayout
    android:fitsSystemWindows="true">

    <!-- main content -->

    <android.support.design.widget.NavigationView
        .. />

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

themes.xml

代码语言:javascript
复制
<style name="MyTheme" extends "Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>

MyActivity.java

代码语言:javascript
复制
onCreate(..) {
    ..
    // This color can be different depending on some conditions.
    DrawerLayout.setStatusBarBackground(color);
}

但是,我一直得到一个灰色的状态栏,并且NavigationView不会在状态栏下绘制。我认为出现灰色状态栏是因为我没有在主题中定义自定义的colorPrimaryDark属性。但是,我假设DrawerLayout.setStatusBarBackground会覆盖并设置状态栏的颜色。我找不到很多关于新NavigationView的文档。有谁有什么想法吗?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30539874

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档