title: Implementing infinite scrolling background with forefront image in android
body: <p>I'm trying do do a infinite scrolling background with a still image in the forefront, similar too a parallax effect. This effect will be in used only once, before the user presses a button to enter the app.</p>
  
  <p>The background image will be composed of several images looping infinitely through them horizontaly.And has to be able to go forward and backward.</p>
  
  <p>I'm struggling with which kind of approach i should use:</p>
  
  <p>I think i'm going to find trouble if i use an horizontalscollView and keep switching images. (example: when i pass the end of the 2nd image, put the 1st in the end)</p>
  
  <p>The second type of approach i tought up is using a custom view and animate in onDraw, in this case which is better: and ImageView or a surfaceView? I heard you should not put other views in front of an animated surfaceView.</p>
  
  <p>The last case is kind of a last resort, is use a special engine (like andengine) to do the drawing.</p>
  
  <p>Which to you think is the best approach in terms of memmory management and ease of implementation?</p>
  
  <p>UPDATE: I decided on using an ImageView (i think any view can be used) to draw everything.
  "z-index" is made with the drawing order. This way gave me the freedom to move different backgrounds at different speeds for the parallax effect. I based the solution loosely on <a href="http://androidtrainningcenter.blogspot.pt/2012/12/android-game-development-moving-or.html" rel="nofollow">this draw function</a> and used a postDelayed on a handler to invalidate the view and force redrawing.</p>
  
  <p>If this aproach works out i'll post an answer sample. </p>