03-20-2013 03:13 PM
I have a horizontal ListView and when I swipe, the cell always sticks to the right edge of the screen, showing part of the cell that is to the left but not showing any of the cell that's to the right. I would like this cell to be centered in the middle of the screen so that the cells on either side of the cell in focus partially show.
Any ideas on how I can accomplish this?
03-20-2013 03:50 PM
03-20-2013 04:21 PM
I am not above faking it
I'm not sure I quite understand. Do you mean you decrease the size of the background of the cell that should be centered?
03-20-2013 04:26 PM
03-20-2013 04:59 PM
spinnerTop.png (note the empty space at the top):
spinnerBottom.png (has some empty space at the bottom!):
When they are split like this, snapping to top produces "snap to center" effect. It's a really weird workaround, but I haven't found any simpler method.
This is how the final control looks like:
03-20-2013 05:05 PM
Ahh I see! Thanks for the great visuals. That is a great idea.
I actually need to show the next cell over though because I'm trying to force the UI to pre-render that cell. The goal is that the cell is fully rendered when the user swipes left or right. The only way I know how to do this is to show it (at least partially) on the screen.
03-20-2013 08:03 PM - edited 03-20-2013 08:08 PM
If you do fancy writing your own then this example is a good starting point to writing a flexible carousel like horizontal scroller, obviously you can strip out the QT parts, circular imagery, the scaling aspects and overlapping if you desire...
Now I've written this, hacking it with padding sounds a lot easier.
03-20-2013 09:36 PM
Use padding on the listview (on whichever side you need to) to force the 'current' item into the middle of the list.
Padding would increase the visual space between cells, wouldn't it? I can't have a gap between cells.