androidanimationandroid-layoutgesturesviewanimator

Flip View like in Contacts Activity (ICS) or Google+ App


I am searching for an easy way to implement a view flipping like used in several occasions by google apps. Behaviour should be like this: OnScroll the view should move to the side and show the content of the next page. If scrolled far enough the view should move smoothly into position (after lifting your finger) and snap into place. If not scrolled far enough and the finger is lifted, the original view should smoothly move to the original view and snap into place.

I search around and didn't figure out a easy way. So I though about something like this: enter image description here

Hide the ScrollBars of the horizontal ScrollView. Set the scrollView position manually according to the position I get from a GestureDetector. I am pretty sure that this way works. But it seems to complicated to me, because there are to many things that have to be programmed. Like the animation (Smooth acceleration, deceleration, snap), Gesture, calculation of the actual position....

So my Question: Am I on the right way or is there an easier approach? Did I miss something during I searched for a solution? Is this function already implemented by android or does it really have to be done by myself?

enter image description here enter image description here


Solution

  • Look for this tutorial. Also if you try to search here, on SO, you will find thousands of similar question with lots of different solutions. You can choose one, that will useful for you.