How to implement a horizontal image gallery in blackberry, like a carousel or springboard in iPhone
I would like to create a blackberry component which has the following capabilities:
- Horizontal scrolling of various image fields much like a carousel/springboard interface.
- Circular dots as indicators for the image that's focused on, located at the bottom.
- When user swipes or slides the images left or right, the next image that's in the center position should be focused and slide animation should lock the image into position.
I'm able to do a simplified version of this where I have three image p开发者_如何学Pythonlaceholders across the screen horizontally. When the user swipes, the images will change (i.e shift left or right, with the focused image in the center).
However, I want to know how I can implement smooth scrolling with momentum, showing the image locking in center when the user scrolls/swipes left or right.
You can try to use fields layout animation. The thing is to update layout position of several fields at the same time.
Otherwise try horizontal scrolling. Use custom HorizontalFieldManager with images and scroll from code.
No matter how you want to do this, you will have to write a function (x coordinate) = f(time) to get this smooth movement and centralization. Maybe even several functions.
Have a good luck!
精彩评论