2016-10-21 8 views
1

첫 번째 문제 먼저 서랍은 상태 표시 줄과 문제의 문제가 없습니다. 그것은 잘 작동합니다.DrawerLayout 및 Collapsing ToolbarLayout을 사용하여 투명 상태 표시 줄을 만들 수 없습니다.

두 번째로 축소 도구 모음을 사용하여 이미지 뒤에 투명 상태 표시 줄을 표시하는 훌륭한 옵션이 있습니다. 예컨대 -

여기

enter image description here

당신은 상태 표시 줄이 투명하게 볼 수 있습니다.

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/drawer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context=".Dashboard"> 

    <android.support.design.widget.CoordinatorLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <android.support.design.widget.AppBarLayout 
      android:id="@+id/appBar" 
      android:layout_width="match_parent" 
      android:layout_height="300dp" 
      android:fitsSystemWindows="true" 
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

      <android.support.design.widget.CollapsingToolbarLayout 
       android:id="@+id/collapsingToolbar" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:fitsSystemWindows="true" 
       app:contentScrim="?attr/colorPrimary" 
       app:expandedTitleMarginEnd="64dp" 
       app:expandedTitleMarginStart="32dp" 
       app:layout_scrollFlags="scroll|exitUntilCollapsed"> 


       <ImageView 
        android:id="@+id/toolbarImage" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:alpha="0.7" 
        android:fitsSystemWindows="true" 
        android:scaleType="centerCrop" 
        android:src="@drawable/morning_1" 
        app:layout_collapseMode="parallax" /> 

       <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

        <TextView 
         android:id="@+id/activity_dashboard_greeting" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_centerHorizontal="true" 
         android:layout_marginTop="40dp" 
         android:text="Good Morning !!" 
         android:textColor="@color/white" 
         android:textSize="28dp" /> 

        <com.meg7.widget.CircleImageView 
         android:id="@+id/activity_dashboard_image" 
         android:layout_width="88dp" 
         android:layout_height="88dp" 
         android:layout_below="@+id/activity_dashboard_greeting" 
         android:layout_centerHorizontal="true" 
         android:layout_marginTop="16dp" 
         android:src="@drawable/arrow_expense" /> 

       </RelativeLayout> 

       <android.support.v7.widget.Toolbar 
        android:id="@+id/toolbar" 
        android:layout_width="match_parent" 
        android:layout_height="?attr/actionBarSize" 
        app:layout_collapseMode="pin" 
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 
      </android.support.design.widget.CollapsingToolbarLayout> 
     </android.support.design.widget.AppBarLayout> 

     <include layout="@layout/content_dashboard" /> 

     <android.support.design.widget.FloatingActionButton 
      android:id="@+id/fab" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical|center_horizontal" 
      android:layout_margin="@dimen/activity_horizontal_margin" 
      android:src="@drawable/ic_add" 
      app:layout_anchor="@+id/appBar" 
      app:layout_anchorGravity="bottom|right" /> 

    </android.support.design.widget.CoordinatorLayout> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/navigation_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     app:headerLayout="@layout/nav_header" 
     app:menu="@menu/menu_navigation"> 

    </android.support.design.widget.NavigationView> 

</android.support.v4.widget.DrawerLayout> 
-

다음

enter image description here

내 코드입니다 -

내가 대신 (코디네이터 DrawerLayout의 직접 자식) Cordinator 하나의 DrawerLayout를 사용하는 지금 만약이 결과를 얻을 수

첫 번째 이미지의 활동이 다른 경우에도 두 번째 이미지에서 똑같은 작업이 발생합니다.

시간 내 주셔서 감사합니다. 미리 감사드립니다.

답변

1

CoordinatorLayout에도 android:fitsSystemWindows="true"을 추가하십시오.

+0

권. 그래서 나 바보 야. 고마워요. –