I tried:
long now = SystemClock.uptimeMillis();
lv.dispatchTouchEvent(MotionEvent.obtain(now, now,
MotionEvent.ACTION_DOWN, 10, 130, 0));
lv.dispatchTouchEvent(MotionEvent.obtain(now+1, now+1,
MotionEvent.ACTION_MOVE, 10, 10, 0));
lv.dispatchTouchEvent(MotionEvent.obtain(now+2, now+2,
MotionEvent.ACTION_UP, 10, 10, 0));
to scroll 120 pixels up, but nothing happened. Is it wrong?
The smoothScrollBy(int, int) sometimes work, sometimes don't. Strange.
On Jul 14, 3:34 pm, "Ericson, Anders"
<[email protected]> wrote:
> Hi,
>
> You can inject motion events to your ListView that corresponds to a 10 pixel
> drag. Create an ACTION_DOWN event and then an ACTION_UP event 10 pixels apart
> and then send them to the ListView using onTouchEvent(). You might need to
> have a ACTION_MOVE event as well.
>
> /Anders
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of yuku
> Sent: den 14 juli 2010 08:12
> To: Android Developers
> Subject: [android-developers] Scrolling ListView manually by pixels
>
> Hi,
>
> I want to make use of the trackball or d-pad to scroll my ListView
> smoothly.
> Without implementing anything, by default the list scrolls by one
> item, which is not appropriate for my app, since list items have
> different heights and I just want to scroll it by a fixed amount.
>
> Is there anything to call to let's say, emulate a 10 pixel drag down?
>
> Thanks.
> Yuku
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en