2017-01-28 11 views

답변

1

내비게이션 서랍 패딩 상단 20dp/24dp 을 설정하고 다음과 같이 탐색 서랍 배경을 설정하십시오.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:top="20dp"> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
     <solid android:color="@color/white"/> 
    </shape> 
</item> 

및 설정 탐색 창 파일

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:paddingTop="20dp" 
    android:fitsSystemWindows="false" 
    android:background="@drawable/menu_navigation" 
    app:headerLayout="@layout/nav_header_home" 
    app:menu="@menu/activity_home_drawer" /> 
0

초기의 대답은 너무 작동 할 수 있지만, 그것은 너무 많은 당신이 달성하고 싶은에 비해하다고 느낀다. 상태 표시 줄 위에 그리지 않도록 탐색보기를 변경할 수 있습니다. 당신의 activity_main.xml 변화 falseNavigationView 요소의 android:fitsSystemWindows에서

. 이렇게하면 원하는 결과를 얻을 수 있습니다.

따라서 코드 블록은 다음과 같이됩니다 : 당신의 탐색 서랍의

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:fitsSystemWindows="false" 
    app:headerLayout="@layout/nav_header_main" 
    app:menu="@menu/activity_main_drawer"/>