2016-08-04 84 views
0

我有一個ActivityFrameLayout包含我的Fragments。 我想設置StatusBar透明的,但我不能做到,我沒有問題設置StatusBar透明單一Activity但不是在一個FragmentStatusBar透明片段Xamarin.Android

This is what i want to achieve

activity_main.axml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:local="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/drawer_layout" 
    android:fitsSystemWindows="true" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent"> 
    <android.support.design.widget.CoordinatorLayout 
     android:id="@+id/main_frame" 
     android:fitsSystemWindows="true" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <FrameLayout 
      android:id="@+id/content_frame" 
      android:fitsSystemWindows="true" 
      android:clipToPadding="false" 
      android:layout_marginBottom="53dp" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 
    </android.support.design.widget.CoordinatorLayout> 
    <FrameLayout 
     android:id="@+id/navigation_frame" 
     android:fitsSystemWindows="true" 
     android:layout_height="match_parent" 
     android:layout_width="wrap_content" 
     android:layout_gravity="left|start" /> 
</android.support.v4.widget.DrawerLayout> 

片段

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 
    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="250dp" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:fitsSystemWindows="true"> 
    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsing_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 
     android:fitsSystemWindows="true" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleMarginStart="48dp" 
     app:expandedTitleMarginEnd="64dp"> 
     <ImageView 
      android:id="@+id/darthvader2" 
      android:src ="@drawable/Xamarin" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scaleType="centerCrop" 
      android:fitsSystemWindows="true" 
      app:layout_collapseMode="parallax" /> 
     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:layout_collapseMode="pin" /> 
    </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 
    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
    </android.support.v4.widget.NestedScrollView> 
</android.support.design.widget.CoordinatorLayout> 

回答

0

我找到了答案,刪除了activity_main.axml中的android:fitsSystemWindows="true"