【问题标题】:StatusBar Transparent in Fragment Xamarin.Android片段 Xamarin.Android 中的状态栏透明
【发布时间】:2016-08-04 08:53:54
【问题描述】:

我有一个 Activity 和一个 FrameLayout,其中包含我的 Fragments。 我想设置StatusBar 透明,但我做不到,我可以在单个Activity 中设置StatusBar 透明但在Fragment 中设置没有问题

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>

【问题讨论】:

    标签: android-fragments xamarin.android android-statusbar


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-11
      • 2017-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多