Android 中灵活 Space 的滚动行为
Scroll behavior of Flexible Space in Android
为了防止再次重新发布我的所有代码,可以找到in this question.
我现在想做的是防止上层imageview在滚动时缩小;相反,我想让它 'static' 这样当下视图在它上面滚动时它就不会向上滚动和缩小。
我会添加一些图片来弥补澄清的损失。
这是屏幕在最大尺寸时的样子:
这是缩小后的样子:
这就是我想要的:
编辑:
忘了说我试过但没用的东西。尝试玩似乎不相关的 ImageView 的 collapseMode。
还尝试使用 CollapsingToolbarLayout
的 scrollFlags 属性,删除标志并添加 enterAlways,但 none 有效。我不知道如何实现这种效果。
最简单的方法是将视差倍数设置为 1:
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="1" />
为了防止再次重新发布我的所有代码,可以找到in this question.
我现在想做的是防止上层imageview在滚动时缩小;相反,我想让它 'static' 这样当下视图在它上面滚动时它就不会向上滚动和缩小。
我会添加一些图片来弥补澄清的损失。
这是屏幕在最大尺寸时的样子:
这是缩小后的样子:
这就是我想要的:
编辑:
忘了说我试过但没用的东西。尝试玩似乎不相关的 ImageView 的 collapseMode。
还尝试使用 CollapsingToolbarLayout
的 scrollFlags 属性,删除标志并添加 enterAlways,但 none 有效。我不知道如何实现这种效果。
最简单的方法是将视差倍数设置为 1:
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="1" />