向下滚动时,EnterAlwaysCollapsed 不会带回工具栏
EnterAlwaysCollapsed does not bring back the Toolbar when scrolling down
我将 layout_scrollFlags="scroll|enterAlwaysCollapsed"
与 0dip
的工具栏 minHeight
一起使用,目的是仅在我在 RecyclerView
是可见的(与 enterAlways
相反,每当向上滚动 RecyclerView
时它会立即返回)。但是,在我将工具栏滚动出屏幕后,工具栏再也不会显示了。我错过了什么?
如果没有看到您的代码很难说,我猜这可能是以下两种情况之一:
1.
这似乎有一个错误,当设置的最小高度大于 zero.Then returns 开始向下滚动时的最小高度和全高时,视图从屏幕上消失当滚动到达顶部时。
我认为您的最小高度为零可能会干扰您的 return。就好像滚动视图以非零最小高度消失一样,谁知道是什么原因导致的,零最小高度可能使得无法 return 这个错误。
看看这个 video found here http://inthecheesefactory.com/blog/android-design-support-library-codelab/en 页面的一半。
我引用这个页面:
enterAlwaysCollapsed - This flag defines how View enter back into the
screen. When your view has declared a minHeight and you use this flag,
your View will only enter at its minimum height (i.e., ‘collapsed’),
only re-expanding to its full height when the scrolling view has
reached it’s top. Use it with scroll flag like this:
scroll|enterAlwaysCollapsed
Anyway it seems like it doesn't work as described in minHeight part.
我强调了。
2.
您的代码格式不正确。
来自 Android's Developer Blog 我引用 "CoordinatorLayout and the app bar":
One note: all views using the scroll flag must be declared before
views that do not use the flag. This ensures that all views exit from
the top, leaving the fixed elements behind.
这篇 link 还详细介绍了如何使用 enterAlwaysCollapsed
,值得一看。
如果这能解决您的问题,请告诉我。
请查看设计支持库示例应用程序:cheesesquare
实现您描述的行为的正确方法是单独使用滚动标志:
layout_scrollFlags="scroll"
我将 layout_scrollFlags="scroll|enterAlwaysCollapsed"
与 0dip
的工具栏 minHeight
一起使用,目的是仅在我在 RecyclerView
是可见的(与 enterAlways
相反,每当向上滚动 RecyclerView
时它会立即返回)。但是,在我将工具栏滚动出屏幕后,工具栏再也不会显示了。我错过了什么?
如果没有看到您的代码很难说,我猜这可能是以下两种情况之一:
1.
这似乎有一个错误,当设置的最小高度大于 zero.Then returns 开始向下滚动时的最小高度和全高时,视图从屏幕上消失当滚动到达顶部时。
我认为您的最小高度为零可能会干扰您的 return。就好像滚动视图以非零最小高度消失一样,谁知道是什么原因导致的,零最小高度可能使得无法 return 这个错误。
看看这个 video found here http://inthecheesefactory.com/blog/android-design-support-library-codelab/en 页面的一半。
我引用这个页面:
enterAlwaysCollapsed - This flag defines how View enter back into the screen. When your view has declared a minHeight and you use this flag, your View will only enter at its minimum height (i.e., ‘collapsed’), only re-expanding to its full height when the scrolling view has reached it’s top. Use it with scroll flag like this: scroll|enterAlwaysCollapsed
Anyway it seems like it doesn't work as described in minHeight part.
我强调了。
2.
您的代码格式不正确。
来自 Android's Developer Blog 我引用 "CoordinatorLayout and the app bar":
One note: all views using the scroll flag must be declared before views that do not use the flag. This ensures that all views exit from the top, leaving the fixed elements behind.
这篇 link 还详细介绍了如何使用 enterAlwaysCollapsed
,值得一看。
如果这能解决您的问题,请告诉我。
请查看设计支持库示例应用程序:cheesesquare
实现您描述的行为的正确方法是单独使用滚动标志:
layout_scrollFlags="scroll"