There is a ScRoolView with a vertical Linear Layout nested. The background of this Linear is a long image (you need to change it when scrolling). Everything is perfectly scrolled, the text is shown, a photo, BUT at the end, when the last inscription on Linear LAyout scrolls, the background continues to scroll (image 400 x 7000). How to make it so that at the end, when the user scrolls to the last inscription, the background stops. Are there any options other than "crop photo on the background"?

  • Of course, I don’t undertake to speak about your specific case, since there’s not much concrete, but in general, it’s irrational to use such a huge image. Have you tried it in practice? The application did not fall? In my practice, not the weakest devices fell on pictures> 4000px on one of the sides due to the limitations of OpenGL. - saturov

1 answer 1

For example:

  1. The existing LinearLayout with the background is placed under the ScrollView.
  2. In the scroll listener the scrollview is moving it.
  3. The contents of the same ScrollView wrap LinearLayout with height = "wrap_content"

Surely using the CoordinatorLayout from the Android Design Support Library to implement the required behavior is not difficult.

  • Thank you for your reply! Could you tell more about the second item? I do not understand how to implement it. Do this in the markup settings or in java? - Dmitry
  • This should be done in the code. Example: stackoverflow.com/a/23365539/3212712 - YuriSPb