app:layout_scrollFlags不起作用

http://stackoverflow.com/questions/31722798/enteralwayscollapsed-does-not-bring-back-the-toolbar-when-scrolling-down/31946043#31946043

1.enterAlwaysCollapsed: 当你的视图已经设置minHeight属性又使用此标志时,你的视图只能已最小高度进入,只有当滚动视图到达顶部时才扩大到完整高度

2. 含有app:layout_scrollFlags的view必须声明在不含该属性的view的布局的前面

 

Hard to say without seeing your code, as a guess this could be one of two things:


1.

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.

You have not formatted your code correctly.

From Android's Developer Blog I quote on "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.

This link also goes into more detail about how to use enterAlwaysCollapsed and is worth looking at.

原文地址:https://www.cnblogs.com/krislight1105/p/5080798.html