Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make a ViewFlipper behave like a Scroller?
    primarykey
    data
    text
    <p>Good day everyone.</p> <p>I am creating a calendar component, and I'm working in the month view. I have created a view named MonthView, and I am adding a couple instances of this to a ViewFlipper:</p> <pre><code>viewFlipper = new ViewFlipper(getContext()); viewFlipper.addView(new MonthView(viewFlipper.getContext())); viewFlipper.addView(new MonthView(viewFlipper.getContext())); </code></pre> <p>I have implemented the fling gesture so that I change views when sliding my finger left or right. This will cyclically update and display the months.</p> <p>Now, I need to give the fling gesture a smoothly effect when touching and slowly sliding my finger. The same we get when we use a Slider instead a ViewFlipper.</p> <p>The problem with Scroller is that the effect is not cyclic. Once I get to the last view, I have to slide in the other direction.</p> <p>I need someone help me find how to give a scroll-like effect to the ViewFlipper, or how to make a Scroller cyclic.</p> <p>Thanks in advance.</p> <p><strong>Extra comment:</strong></p> <p>I have already implemented a ViewFlipper with 2 views. I update the views by using the SimpleOnGestureListener.onFling(...) method, and the behavior I got is something like this:</p> <p>Imagine I always slide from rigth to left, like flipping a book's page to read the next one, and also imagine there is a caption in the header of the view that is displayed after flipping.</p> <p>View # 0 --> Caption: January 2011</p> <p>View # 1 --> Caption: Febrary 2011</p> <p>View # 0 --> Caption: March 2011</p> <p>View # 1 --> Caption: April 2011</p> <p>View # 0 --> Caption: May 2011</p> <p>If at this point I slide from left to right, the result will be something like:</p> <p>View # 1 --> Caption: April 2011</p> <p>View # 0 --> Caption: March 2011</p> <p>The ability to cyclically move forward or backward, giving the user the idea of having infinite views, but using only a couple is characteristic of ViewFlipper, and that's what I can't loose. That's why I need a way to add the cool scroll effect without loosing what I've got.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload