Accelerate onItemSelected(...) on a Gallery with setCallbackDuringFling(false)
I have made an extended Gallery class that uses small thumbnail images to allow for fast, low-memory scrolling and then loads in higher-resolution ones when the Gallery has stopped moving. I was previously populating the larger images into the Gallery as soon as I got them but this caused the stutter problem described in
android gallery view "stutters" with deferred image loading adapter
So now the Gallery calls setCallbackDuringFling(false); 开发者_StackOverflow社区on construction and I repopulate from the onItemSelected(...) method. Unfortunately this means nothing happens till the Gallery stops moving, which can take quite a long time owing to what I assume are the exponential decay physics of the fling method. In particular, if a user halts the Gallery it seems intuitive to me that the Gallery should snap to its selected position quite quickly, ideally in a time proportional to how far off centre it is when released.
Is it possible to force the onItemSelected event to occur faster? I would use setSelection but for obvious reasons I don't know what position value to choose because none has been returned by the Gallery!
精彩评论