我想实现与您在 Google Play 商店 中看到的效果类似的效果,滚动内容时,工具栏
会在您滚动时离开屏幕。
这与在 #io15 中介绍的 CoordinatorLayout
( 1 ) 一起工作正常,但是:如果您“中途”停止滚动,工具栏将保留在屏幕上, 但被切成两半:我希望它在屏幕外显示动画,就像在 Google Play 商店中一样。 我怎样才能做到这一点?
最佳答案
现在 Android 支持库 23.1.0 有一个新的滚动标志 SCROLL_FLAG_SNAP
可以让您实现这种效果。
AppBarLayout supports a number of scroll flags which affect how children views react to scrolling (e.g. scrolling off the screen). New to this release is SCROLL_FLAG_SNAP, ensuring that when scrolling ends, the view is not left partially visible. Instead, it will be scrolled to its nearest edge, making fully visible or scrolled completely off the screen.
关于android - 协调器布局 : Hiding/Showing half visible toolbar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30575293/