开发者

Android Gallery: how to detect that an item has shifted in Gallery (and shift direction)

I am using a Gallery based Cover-flow, as suggested here.

Is there an event that can be caught, which indicates that a single shift (either left or right) has been made in my gallery/cover-flow?

To be clear, if I gave the gallery a decent swipe and my center (selected) image has changed 8 times, I would like to catch this event 8 times.

OnFling() just indicates a single swipe - regardless how many items have shifted.

Getting getSelect开发者_StackOverflow社区edItemPosition() before and after the swipe doesn't help since I need to do some work on every shift.

It will also be nice while I am at it, to get the direction of the shift - either right or left.


If I understand you correctly you should implement this interface and set it to you Gallery with setOnItemSelectedListener method, also setCallbackDuringFlingmight be usefull.
To get fling direction you can save last selected position and compare it with new one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜