Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

java - Scroll behavior of Flexible Space in Android

To prevent from re-posting all my code again, it can be found in this question.

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:

enter image description here

This is how it looks when it's shrinked:

enter image description here

This is what I want:

enter image description here

Edit: 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...