android - 协调器布局 : Hiding/Showing half visible toolbar?

标签 android android-toolbar

我想实现与您在 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/

相关文章:

Android Google 登录失败,错误代码为 8(无消息)

android - 像 gmail Android 一样更改工具栏?

Android 支持工具栏无法正确显示自定义可绘制对象

android - 如何让 TextView 过渡到折叠工具栏中的标题?

android - 导航图标 toast 提示

android - 菜单项下工具栏的下边框未正常显示

android - Google Play 服务没有 gps 图标

java - Android - 返回时 ListView 为空

android - 寻找适用于 Android 的 ANPR/LPR(自动车牌识别/车牌识别)SDK

布局膨胀的 Android Fragments