开发者

Actions on gallery view android

Actions on gallery view android

i have two gallery views in my single UI screen or you may say activity, i want to have listener in such a way that on scroll of one gallery view the other should also scroll , i tried givi开发者_如何学Cng listener to one gallery and calling the other one gallery view into that ., but its working for me , pls can any one help me..

thanks in advance Datta


You could try to find the position of one of the galleries with Gallery.setOnItemSelectedListener() and then update the other gallery with Gallery.setSelection().


I believe the Gallery view is missing a lot of functionality (or is broken) as compared to ListView or GridView. In this particular instance, you need a "setOnCenteredItemChangedListener" or something like that. However, the documentation does not show anything close to this.

One option would be to implement your own Gallery class using HorizontalScrollView.

Another (hacky) option would be to rely on your Gallery adapter to push the current position being fetched (which may NOT be the one displayed in the middle) and use that to guess the currently selected position.


You have to override the scroll event of your first gallery and inside this method you should call the onScroll event of your second gallery like this,

gallery_two.onScroll(MotionEvent e1,MotionEvent e2,x,y);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜