ここの例に従って、新しいマテリアル デザイン サポート ライブラリのNavigationViewをアプリに統合します。
私の一般的なレイアウトは次のようになります。
活動.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
。誰にもアイデアはありますか?