Android 视差模式在折叠工具栏布局中不起作用

Android 视差模式在折叠工具栏布局中不起作用,android,android-layout,parallax,android-collapsingtoolbarlayout,Android,Android Layout,Parallax,Android Collapsingtoolbarlayout,我正在设置折叠工具栏布局。我已经为工具栏下方的相对布局设置了视差模式 但当我向上滚动工具栏时,它不会褪色。我只是在工具栏标题上方显示相对布局。它与工具栏合并 将所有模式都设置为静止状态,它正在合并 布局: 怎么了 请帮助,谢谢。在您的相对布局中,在下面的行中放置: app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed" 尝试从相对布局中删除enterally 仅使用此项。 app:layout_scrollFlag

我正在设置折叠工具栏布局。我已经为工具栏下方的相对布局设置了视差模式

但当我向上滚动工具栏时,它不会褪色。我只是在工具栏标题上方显示相对布局。它与工具栏合并

将所有模式都设置为静止状态,它正在合并

布局:

怎么了


请帮助,谢谢。

在您的相对布局中,在下面的行中放置:

app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
尝试从
相对布局中删除
enterally

仅使用此项。

app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
对于例如您的
布局
工具栏
应位于
相对布局
下方



将协调人布局添加为您的父布局。您可以共享屏幕吗。我已将协调人布局添加为父布局,不知道为什么无法获得post@piyushgupta检查此链接请检查添加的屏幕@杰洛德,快去吧。我在上面添加了工具栏,相对布局应该在布局下面@JAHYDROIDERYES它应该在
工具栏布局下方
@user6265109编辑了我的答案,请参考。@user6265109如果它起作用,那么接受并向上投票答案,这样问题就结束了。
app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
<RelativeLayout
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="250dp"
            android:background="@drawable/header"
            android:fitsSystemWindows="true"
            android:scaleType="centerCrop">

            <ImageView
                android:id="@+id/imageViewPhoto"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:layout_centerInParent="true"
                app:layout_collapseMode="parallax" />

            <TextView
                android:id="@+id/textViewName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="false"
                android:layout_below="@+id/imageViewPhoto"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="5dp"
                android:text="TEXT"
                android:textSize="16dp" />

        </RelativeLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:fitsSystemWindows="true"
            android:gravity="top"
            app:layout_collapseMode="pin"
            app:layout_scrollFlags="scroll|enterAlways">

            <TextView
                android:id="@+id/toolbar_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:textSize="20dp"
                android:textStyle="bold" />
        </android.support.v7.widget.Toolbar>