Android的旋转木马图片库
我怎么能旋转木马永远也不会被结束。经过去年第一形象,第一最后图像之前的图片库。
How can i carousel image gallery which never gets end.. after last first image and before first last image.
我创造我自己的名单适配器这样做(从子类 BaseAdapter)。 我$ C $光盘您自己的列表适配器以这样的方式,它的getCount将()方法 返回HUUUUGE号码。 如果项目'X'被选中,那么这个项目对应的适配器 位置='adapter.getCount()/ 2 + X' 而对于我的适配器的方法的getItem(INT位置),我看在我的数组 该备份适配器和获取索引的项目: (位置getCount将()/ 2)%myDataItems.length 你需要做一些特别的东西,使一切工作 正确的,但你的想法。 原则上,它仍然是可能达到的末端或初 在名单中,但如果你设置getCount将()约一百万左右,这 很难做到:-)
I did this by creating my own list-adapter (subclassed from BaseAdapter). I coded my own list-adapter in such a way that its getCount() method returns a HUUUUGE number. And if item 'x' is selected, then this item corresponds to adapter position='adapter.getCount()/2+x' And for my adapter's method getItem(int position), i look in my array that backs up the adapter and fetch the item on index: (position-getCount()/2) % myDataItems.length You need to do some more 'special' stuff to make it all work correctly, but you get the idea. In principle, it is still possible to reach the end or the beginning of the list, but if you set getCount() to around a million or so, this is hard to do :-)