Infinite Slideview

Hi Everyone!

I just found out about Corona and I’m really excited!

I want to write an application that quizzes kids learning arithmetic. My initial thought is to create a card that has a randomly generated problem; e.g., 5 + 2. This would be presented on the screen and you could double tap the screen to get the answer. To move onto the next problem, you could slide your finger across the screen to present the next randomly generated problem.

My initial thought is to use a slideview, but this presents a couple of problems.

  1. All the problems have to be created initially when creating the slideview.
  2. The number of slides have to be known initially.

I want to be able to infinitely slide to the next problem. I’m not sure if a slideview is the right way of solving this or if I should use a different strategy.

Any help or suggestions are appreciated.

Thanks,

Mike

You should use a different approach since I don’t think the slideview was designed with that kind of functionality in mind. What you can do is actually very simple. You can have two cards at once, the one that’s on screen and a second one off screen. You can make that by dragging the card on the screen pulls the one that’s off screen to replace it. Once the second one is on the screen you put the first where the second one was initially. That way you’ll create the illusion is an infinite slider of cards. Here’s a little sketch of the action:

gasvfX4.jpg

I think you’re actually both right: scrollview (I assume that’s what you mean) is capable of doing that as you can set the scroll width any time you like.

@hectots approach is better, however, and it’s really just a little bit of maths to get the appropriate sliding behaviour.

You should use a different approach since I don’t think the slideview was designed with that kind of functionality in mind. What you can do is actually very simple. You can have two cards at once, the one that’s on screen and a second one off screen. You can make that by dragging the card on the screen pulls the one that’s off screen to replace it. Once the second one is on the screen you put the first where the second one was initially. That way you’ll create the illusion is an infinite slider of cards. Here’s a little sketch of the action:

gasvfX4.jpg

I think you’re actually both right: scrollview (I assume that’s what you mean) is capable of doing that as you can set the scroll width any time you like.

@hectots approach is better, however, and it’s really just a little bit of maths to get the appropriate sliding behaviour.