Thursday, June 10, 2010

[android-developers] Re: ListView

Prepare to be stunned, I think.

I faced a similar issue with horizontal SeekBar's in a vertical
scrolling list. I went through a number of iterations trying to get
these to play nice.

What finally worked, I think would work here, too:

An onTouchEvent(MotionEvent) method that tracks how much it has moved
horizontally and vertically. Beyond a threshold, it goes into "scroll"
mode, and starts scrolling the parent ScrollView with
ScrollView.scrollBy(int, int).

I tried to manage the flow of events in various ways, to route the
events to the scroller. That turned out to be a lot harder than I
expected. This turned out to be quite easy.

The situation here will be slightly different in that you need to pass
the events down to the children. I think super.onTouchEvent(event)
will handle this for you, but I've found there's a few things about
the event handling that I don't fully understand and can't readily
reverse-engineer from simple observations. I haven't read the code...

On Jun 10, 4:06 am, Mark Murphy <mmur...@commonsware.com> wrote:
> Sandy wrote:
> > Actually the link I was referring to was horizontalscrollview within a
> > scrollview (NOT a listview like i mentioned below). Here it is:
>
> >http://stackoverflow.com/questions/2646028/android-horizontalscrollvi...
>
> > This will not work for me because the functionality I desire to have
> > is a vertical ListView with 100 list items and the selected item will
> > have few buttons (around 10) which can be scrolled horizontally.
>
> I will be stunned if a HorizontalScrollView will work in a ListView row.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.1
> Available!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment