Hi Pavel,

Thanks for your reply!  I agree with some of the information you
provided.

So it seems ListView is keeping track of the list state. To name a
few; scroll position, visible items, user input.

I guess the main idea here is in order to create a completely custom
ListView we need to handle displaying the list items as the user
scrolls.  But to me that seems like too much work, almost re-inventing
the wheel.

My main concern is get and set scroll position smoothly... Thanks to
your post I got a little idea to compute scroll position but not sure
about setting the scroll position. I am able to scroll smoothly via
dispatchTouchEven(...) but it's not accurate, might scroll little too
much and sometimes not enough...  I got some code for that I can get
if you want to see that...

-Moto



On Apr 27, 3:14 am, Pal <[email protected]> wrote:
> Hi Moto,
>
> at this moment I'm working on my own custom ListView implementation so
> I can share some investigations I've found about ListView internals.
> 1) First of all ListView is adapter view that means that it uses
> adapter object to get it's child views - take a look at
> ArrayAdapter.getView(int, View, ViewGroup)
> 2) ListView at the moment only contains children that are on the
> screen. For example, if you have adapter with 100 records but only 5
> are fit on screen ListView.getChildCount will return 5 not 100
> 3) each time you scroll your list it refresh dynamically its children
> list getting child view from adapter and/or relayouting existing views
> offsets
>
> I dont have best understanding now but I think ListView state is : 1)
> first position of child view of screen 2) offset of child view within
> parent view
> if you know first position and it offset you can simply get from
> adapter and draw other ones
>
> android.widget.AdapterView.getFirstVisiblePosition() will give you a
> position of first item within adapter data on the screen
> use getChildCount() and getChildAt() of ListView to get current child
> views so you can obtain some layout details
> ListView.setSelection(int) allows you to sets the currently selected
> item but I think It will not scroll smoothly to it...
>
> Hope this will help you
>
> Thanks,
> Pavel
>
> On 27 апр, 03:05, Moto <[email protected]> wrote:
>
>
>
> > I hope someone can shed some light? :(
>
> > On Apr 25, 9:37 pm, Moto <[email protected]> wrote:
>
> > > I'm trying to figure out how it's been designed.  How it holds its
> > > items?  How do I get a hold of the scrolling container?  How can I
> > > know it's exact scrolling position?  How can I scroll it to an exact
> > > position?
>
> > > I want to have all the current benefits the ListView provides plus
> > > detailed scrolling control... How about animating from x to x+100
> > > scroll position?
>
> > > Maybe I need to create my own ListView?  Where do I begin?
>
> > > Thanks for the help!
> > > -Moto!
>
> > > --
> > > 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 
> > 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 
> 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

Reply via email to