android – CoordinatorLayout:隐藏/显示半可见工具栏?

前端之家收集整理的这篇文章主要介绍了android – CoordinatorLayout:隐藏/显示半可见工具栏?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Id喜欢实现与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.

原文链接:https://www.f2er.com/android/312268.html

猜你在找的Android相关文章