header 图像下方的 CollapsibleToolbarLayout 行和后退按钮未显示

CollapsibleToolbarLayout line below header image and back button not showing

我已经实现了如下所示的 CollapsibleToolbarLayout。

<android.support.design.widget.CoordinatorLayout 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: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="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:contentScrim="?attr/colorPrimary"
        android:fitsSystemWindows="true"
        app:expandedTitleMarginEnd="40dp"
        app:expandedTitleMarginStart="20dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/imgPoster"
                android:scaleType="centerCrop"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax"
                android:background="@drawable/place_holder_land" />
            <View
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/detailsGradient" />
            <ImageView
                android:id="@+id/play"
                android:layout_width="wrap_content"
                android:visibility="invisible"
                app:layout_collapseMode="parallax"
                android:layout_gravity="center"
                android:src="@drawable/ic_play_movie"
                android:layout_height="wrap_content" />
        </FrameLayout>
        <android.support.v7.widget.Toolbar
            android:id="@+id/anim_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
    android:id="@+id/scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="fill_vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">
 ...LinearLayout omitted...
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="16dp"
    android:clickable="true"
    android:src="@drawable/ic_file_download"
    app:layout_anchor="@+id/appbar"
    app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>

我在工具栏的框架布局中添加了图像视图,这样我就可以在图像上叠加和渐变,使工具栏文本在某些图像上可见

但是在添加框架布局时,这条色线就在图像下方(见屏幕截图)。如果我删除该行 android:fitsSystemWindows="true" 从 appbarlayout 然后颜色线消失但工具栏也从视图中滚动...

同时为了在工具栏上显示后退按钮,我在 OnCreate 中添加了以下代码,但它仍然没有显示

 toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.anim_toolbar);
        SetSupportActionBar(toolbar);

        SupportActionBar.SetDisplayHomeAsUpEnabled(true);
        SupportActionBar.SetHomeButtonEnabled(true);
        SupportActionBar.Title = content.Title;
        toolbar.SetNavigationIcon(Resource.Drawable.ic_action);

        collapsingToolbar = FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);
        collapsingToolbar.SetTitle(content.Title);

谢谢...

考虑为您的应用栏布局添加固定宽度

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

好的,知道了,现在必须删除

android:fitsSystemWindows="true"

来自

<android.support.design.widget.CoordinatorLayout 
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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

现在一切都好

谢谢