EcoGallery icon indicating copy to clipboard operation
EcoGallery copied to clipboard

I can't scroll EcoGallery with Views which are clickable like Buttons ...

Open Kcorab opened this issue 10 years ago • 5 comments

Hello, I want to use the EcoGallery like a horizontal ListView with locking centre. My BaseAdapter holds a lot of Buttons which are match_parent in height and width. An OnClickListener is set for any Button. Now the problem is that the EcoGallery is not scrollable.

For the old Gallery a similar problem existed but was solved very well. Please see: http://stackoverflow.com/questions/8127828/scrolling-a-gallery-with-buttons

Can you extend the EcoGallery for one setter-methode which makes the EcoGallery scrollable in this case?

Kcorab avatar Aug 10 '14 19:08 Kcorab

Unless you have a very good reason to use a gallery, I suggest you use a ViewPager.

Gryzor avatar Aug 10 '14 20:08 Gryzor

I have thought about it more than one time. If you have got a very good reason for using some "special" class then use this class and no "bad" alternative. ;-)

In my opinion ViewPager is a peculiar construct. It doesn't use View recycling and I am only able to scroll slowly. But this is only the estimation from a newcomer.

I love (Eco)Galley so much.

Kcorab avatar Aug 11 '14 08:08 Kcorab

I have hacked around the Gallery long enough to know how bad the code is (and I can imagine why Google engineers saw the code and said, well we gotta deprecate this hack). ;)

In any case, if you still want to use it, I suggest you use my (little bit enhanced) version: https://github.com/Gryzor/TimelineGallerySample

Please note that I do not use it anymore.

There are multiple ViewPager forks (the source is open) that scroll faster and provide other sorts of niceties. In my experience, it doesn't feel like the old gallery, ever, but it's generally more stable, faster and less problematic in the long run. (In the short term it's more annoying because you have to deal with the ViewPager "Peculiarities". ;)

You can achieve most (if not all) of the old gallery features (center, scroll, fling, etc.) with a ViewPager.

Unless you really really need the Gallery, I recommend you learn and try ViewPagers. They seem to be here to stay anyway.

Good luck!

Gryzor avatar Aug 11 '14 17:08 Gryzor

@Gryzor Agree, they deprecate it for a good reason. @Kcorab Not familiar with @Gryzor version of Gallery but I recommend looking at it, hopefully it fixes your issue. If not, you could extend the EcoGallery and do the same thing that was mentioned in the SoF answer since EcoGallery extend Gallery view, feel free to send a pull request if you got it working :).

falnatsheh avatar Aug 11 '14 18:08 falnatsheh

Thanks for your answers. What I was searching for is an equivalent of Gallery. A horizontal ListView with centre locking maybe ... A fork of ViewPager which supports multiple pages, fling and ViewRecycling I didn't find.

@falnatsheh As I said I am a android- and java newcomer. I am not able to extend your class because of my deficient skills. :-(

I will keep searching. :-)

Kcorab avatar Aug 13 '14 07:08 Kcorab