2015-06-20 81 views
1

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


Screenshot of device with drawer layout


我没有抽屉任何填充,而我对TextView没有余量。这是我layout.xml文件:Android在状态栏下绘制

<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

事实证明,我还以为android:fitsSystemWindows="true"做什么它实际上正好相反,所以只是从所有的意见,删除和它应该很好地工作。感谢Google Plus上的+der Android Pro