CoordinatorLayout:隐藏/显示一半可见的工具栏? [英] CoordinatorLayout: Hiding/Showing half visible toolbar?

查看:434
本文介绍了CoordinatorLayout:隐藏/显示一半可见的工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还想来达到类似的效果为一个你可以看到在谷歌Play商店,其中通过滚动含量工具栏熄灭-screen为您滚动。

Id like to achieve a similar effect as the one you can see in Google Play store, where by scrolling the content the Toolbar goes off-screen as you scroll.

这工作正常的 CoordinatorLayout (<一href="http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html">1)在推出的#io15 ,但是:如果停止滚动中途工具栏仍保留在屏幕上,但减少了一半:我希望它关屏动画,就像在谷歌Play商店。我怎样才能做到这一点?

This works fine with the CoordinatorLayout (1) introduced at #io15, however: If you stop the scroll "mid-way" the Toolbar remains on screen, but is cut in half: I want it to animate off-screen, just like in the Google Play store. How can I achieve that?

推荐答案

现在Android的支持库23.1.0有一个新的滚动标记 SCROLL_FLAG_SNAP ,它允许你实现这个的效果。

Now the Android Support Library 23.1.0 has a new scroll flag SCROLL_FLAG_SNAP which allows you to achieve this effect.

AppBarLayout支持一些滚动的旗帜,影响孩子的意见,以滚动(如滚动关闭屏幕)的反应。这次发布的新品是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.

这篇关于CoordinatorLayout:隐藏/显示一半可见的工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆