【发布时间】:2015-06-20 15:51:23
【问题描述】:
我正在设计一个在 Android Lollipop 上的应用程序,该应用程序在状态栏下绘制一个Navigation Drawer。我在这方面取得了部分成功。我可以让抽屉在状态栏下绘制,但不能让抽屉的内容。
我的抽屉里没有任何填充物,TextView 上也没有边距。这是我的 layout.xml 文件:
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeActivity"
android:fitsSystemWindows="true">
<!--window content -->
<LinearLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="#FF5722"
android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
android:minHeight="?android:attr/actionBarSize"
android:elevation="4dp"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/grid_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>
</LinearLayout>
<!-- The navigation drawer -->
<RelativeLayout
android:id="@+id/left_drawer"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#f5f5f5"
android:elevation="16dp"
android:fitsSystemWindows="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, Drawer!"
android:fitsSystemWindows="true"/>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
我已经尝试在TextView 上放置一个负顶部填充,但它只是被夹在状态栏下方,我只看到抽屉背景。如何让抽屉元素的子元素在状态栏下绘制?
谢谢
【问题讨论】:
标签: android android-layout drawerlayout