我正在按照here的例子将新的Material Design Support库的NavigationView集成到我的应用程序中。
我的总体布局如下所示:
activity.xml
<android.support.v4.widget.DrawerLayout
android:fitsSystemWindows="true">
<!-- main content -->
<android.support.design.widget.NavigationView
.. />
</android.support.v4.widget.DrawerLayout>
themes.xml
<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
onCreate(..) {
..
// This color can be different depending on some conditions.
DrawerLayout.setStatusBarBackground(color);
}
但是,我一直得到一个灰色的状态栏,并且NavigationView
不会在状态栏下绘制。我认为出现灰色状态栏是因为我没有在主题中定义自定义的colorPrimaryDark
属性。但是,我假设DrawerLayout.setStatusBarBackground
会覆盖并设置状态栏的颜色。我找不到很多关于新NavigationView
的文档。有谁有什么想法吗?
https://stackoverflow.com/questions/30539874
复制相似问题