prevent CollapsingToolbarLayout崩溃,如果没有必要 [英] Prevent CollapsingToolbarLayout collapse if not needed

查看:245
本文介绍了prevent CollapsingToolbarLayout崩溃,如果没有必要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用:

compile 'com.android.support:design:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'

随着项目 Cheesesquare 更新。

进入奶酪的细节,我取出2张卡(只生一个)。有没有一种方法,以prevent,显示一个空白工具栏的崩溃?

Into the detail of cheese, I remove 2 cards (to have only one). Is there a way to prevent the collapsing of the toolbar that show a blank space?

在这里输入的形象描述

推荐答案

要实现 Cheesesquare 这样的行为例如只需要修改安卓的NestedScrollView的layout_height 参数为 WRAP_CONTENT
它将prevent由内容滚动,如果它是足够小,适合在屏幕上。

To implement such behaviour in Cheesesquare example just modify android:layout_height param of the NestedScrollView to wrap_content. It will prevent scrolling by content if it is small enough to fit on the screen.

和由 Col​​lapsingToolbarLayout prevent滚动,你应该以编程方式设置 layout_scrollFlags 参数设置为 AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP 值。

And to prevent scrolling by CollapsingToolbarLayout you should programmatically set layout_scrollFlags parameter to the AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP value.

<一个href=\"http://stackoverflow.com/questions/32407936/change-layout-scrollflags-programmatically-in-collapsingtoolbarlayout/33217085#33217085\">Here描述你如何能做到这一点。

Here described how you can do this.

这篇关于prevent CollapsingToolbarLayout崩溃,如果没有必要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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