Reputation: 39255
I really need horizontal scrolling in my app, so I overrode Gallery and I'm trying to do something with an OnItemSelectedListener, and a GestureDetector I'm calling from an OnTouchListener I've set on the Gallery. What I want is to remove the auto-selection of Gallery items as I scroll, but I want to be able to click an item to select it.
If I set an OnClick listener on a view that is populated in the adapter, the Gallery fails to scroll. Also, the OnItemClicked event is never called for the listener I set for that on the Gallery.
Upvotes: 0
Views: 2937
Reputation: 1
Why not you set some tag while you click on an item in the Gallery to select. Now once again when you click after the item is selected just check for the tag that you had set, and based on the condition you can move to new screen and whatever task you want to perform.
But keep one thing in mind, you have to set the tag with every gallery item while building the gallery view.
I hope you will get what I want to say.
If still you have any problem then let me know.
I had the same scenario and I solved that.
Upvotes: -1
Reputation: 81
To remove selection from all items you should do this:
youGallery.setUnselectedAlpha(1);
Upvotes: 3
Reputation: 26991
For your case why dont you just use a HorizontalScrollView. Just put a linear layout inside and add as many imageview's as you need if your using images, or dynamicaly add it in java code.
This will elemenate the selection of gallery by default. This will be easier than trying to Override the Gallery widget default methods.
Upvotes: 0
Reputation: 8787
Maybe my answer to this question will help you. It's something which wasn't intended to be ever realized...
Upvotes: 1