我在新的材料设计Side Nav规范中看到,您可以在操作栏上和状态栏后面显示抽屉.我该如何实现呢?
我正在尝试让我的导航抽屉进入状态栏.我已经阅读了很多关于ScrimInsetsFrameLayout视图的内容,我尝试实现它,但由于某种原因它不会被删除.
这是我使用/编写的代码.
XML DrawerLayout:
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/toolbar" />
</FrameLayout>
<com.andrewq.planets.util.ScrimInsetsFrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/linearLayout"
android:layout_width="304dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:insetForeground="#4000">
<ListView
android:id="@+id/left_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice" />
</com.andrewq.planets.util.ScrimInsetsFrameLayout>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
ScrimInsetsFrameLayout.java:
package com.andrewq.planets.util;
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License …Run Code Online (Sandbox Code Playgroud)