DrawerLayout の setStatusBarBackground() や setStatusBarBackgroundColor() を使う。
補足
DrawerLayout では android:fitsSystemWindows="true" がセットされている場合、自分で StatusBar 部分を描画します。
- public class DrawerLayout extends ViewGroup implements DrawerLayoutImpl {
- ...
- private Drawable mStatusBarBackground;
- ...
- public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- ...
- if (ViewCompat.getFitsSystemWindows(this)) {
- IMPL.configureApplyInsets(this);
- mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
- }
- ...
- }
- ...
- @Override
- public void onDraw(Canvas c) {
- super.onDraw(c);
- if (mDrawStatusBarBackground && mStatusBarBackground != null) {
- final int inset = IMPL.getTopInset(mLastInsets);
- if (inset > 0) {
- mStatusBarBackground.setBounds(0, 0, getWidth(), inset);
- mStatusBarBackground.draw(c);
- }
- }
- }
- }