how does scrolling in android listview work?
- by gartenkralleb
hi,
i have an android-app with a listview in an activity. the listview has, if i call it so, three data states.
no data loaded from inet - only one dummy item is visible, saying that data is loading
data is loaded and shown in list
one listitem is clicked and now shows more information for this listitem (so it is increased in its height)
on every state change (1 - 2, 2 - 3) i call notifyDataSetChanged() on this ListAdapater.
this causes the listview to scroll down to the last item. this is ugly in the first transition and even more ugly in the second because the clicked list item is now out of focus.
as i can see, this happens with a google g1 with android 1.6. a htc touch with the same sdk acts like desired (i try to figure it out with some more devices).
to avoid this i tried to read out getScrollY() and set this value back. but this returns 0. the reason for this return value i already found on stackoverflow in other qutestions.
does anyone else comes along with my problem so far? why does the listview scrolls to the last item? it was mentioned, that listview does keep track on the scroll position. but it seems that it does not in my case.
or may i call the wrong refresh method? is notifyDataSetChanged the correct one?