Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have scrolling animation programmatically

I'm trying to implement scroll animation for gallery programmatically.

Tried with setSelection(int pos, Boolean animate) and it's not working.

Is there anyway to override setSelection() method.

like image 852
Samurai Avatar asked Sep 26 '10 20:09

Samurai


People also ask

What is scroll trigger?

The scroll depth trigger is used to fire tags based on how far a user has scrolled down a web page. To configure a scroll depth trigger: Click Triggers.


2 Answers

Just now I have got this problem. I was need to move just one element of the gallery, so the best solution to me was to emulate key down event

myGallery.onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT, null);

or

myGallery.onKeyDown(KeyEvent.KEYCODE_DPAD_LEFT, null);
like image 142
pleerock Avatar answered Oct 20 '22 03:10

pleerock


Gallery.setSelection(int position, boolean animate);

Refer below URL: http://groups.google.com/group/android-developers/browse_thread/thread/9140fd6af3061cdf/7f89e53ae53e455b?lnk=gst&q=setselection#7f89e53ae53e455b

Soln: If you're still looking, I have two possible solutions for you, both slightly unpleasant:

(1) You can make the gallery do a fling with a chosen velocity, thus:

myGallery.onFling(null, null, velocity, 0);

By tweaking the velocity, you can set up values to move the selection by one or two in either direction. As the Gallery self-centers, you do not need to get the destination exactly right.

(2) As the Gallery source is available, you can modify it in order to implement your own Gallery. It doesn't look as though you need to add much code to be able to control a fling so as to end at your chosen selection.

I thought I was going to have to do (2), but found I could get away with (1) for my problem.

like image 36
Samurai Avatar answered Oct 20 '22 01:10

Samurai