无法隐藏工具栏+回收站视图

时间:2015-08-22 03:58:58

标签: android toolbar material-design

我在不使用折叠工具栏的情况下创建了工具栏。我需要隐藏工具栏,向上滚动Recycler view.i,然后链接滚动/隐藏工具栏

http://android-developers.blogspot.com/2015/05/android-design-support-library.html

这是我的xml

{{1}}

这是我的输出 enter image description here 我不确定它出了什么问题。我做的每件事都是正确的。但在滚动回收器视图时,工具栏保持在相同位置。它没有隐藏。

非常感谢您的帮助。

2 个答案:

答案 0 :(得分:2)

使用wrap_content Toolbar时存在已知问题。相反,使用固定的高度:

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

您注意我使用scroll|enterAlways - exitUntilCollapsed仅在您使用CollapsingToolbarLayout(或任何具有不同layout_height和{的布局时才有意义{1}})。

答案 1 :(得分:0)

还要确保 build.gradle至少buildToolsVersion "22.0.1"

compile 'com.android.support:design:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'