问题描述
要从重新张贴prevent我所有code再次,可以发现
To prevent from re-posting all my code again, it can be found in this question.
我想什么现在要做的,就是prevent直接从滚动萎缩上ImageView的;相反,我想使静态,所以它不会滚动,当下方的视图被滚动在它萎缩。
What I'd like to do now, is to prevent the upper imageview from shrinking upon scrolling; instead, I'd like to make it 'static' so it won't scroll up and shrink when the lower view is scrolled over it.
我将添加一些图片来补偿澄清的损失。
I'll add some pictures to compensate for the loss of clarification.
这是屏幕如何看待它的最大尺寸:
This is how the screen looks at it's fullest size:
这是当它收缩它的外观:
This is how it looks when it's shrinked:
这是我想要的:
编辑:
忘了提我的尝试,并没有工作。试图与这似乎并不相关的ImageView的collapseMode播放。
还试图与CollapsingToolbarLayout的scrollFlags属性弹,删除标志,增加enterAlways,但没有奏效。我对如何达到这样的效果毫无头绪。
Forgot to mention what I tried and didn't work. Tried playing with the collapseMode of the ImageView which appears not related.Also tried playing with the scrollFlags attribute of the CollapsingToolbarLayout, removing flags and adding enterAlways, but none worked. I have no clue on how to achieve this effect.
推荐答案
这个简单的方法是将视差倍频设置为1:
This simplest way would be to set the parallax multiplier to 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" />
这篇关于在Android的灵活空间的滚动行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!