Android状态栏下的抽奖

时间:2015-06-20 15:51:24

标签: android android-layout drawerlayout

我正在设计Android Lollipop上的应用,在状态栏下绘制Navigation Drawer。我已经取得了部分成功。我可以让抽屉在状态栏下绘制,但不能抽出抽屉的内容

Screenshot of device with drawer layout


我的抽屉上没有任何衬垫,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上添加一个负顶部填充,但它只是被剪切在状态栏下方,我只看到抽屉背景。如何让抽屉元素的子项在状态栏下绘制?

谢谢

1 个答案:

答案 0 :(得分:1)

事实证明,我认为android:fitsSystemWindows="true"的确与实际相反,所以只需从所有视图中删除它,它就应该完美无缺。感谢Google Plus上的+der Android Pro

相关问题