Scroll a ListView by pixels in Android?

The supported way to scroll a ListView widget is: mListView. SmoothScrollToPosition(position) developer.android.com/reference/android/...) However since you mentioned specifically that you would like to offset the view vertically, you must call: mListView. SetSelectionFromTop(position, yOffset) developer.android.com/reference/android/...) Note that you can also use smoothScrollByOffset(yOffset) However it is only supported on API >= 11 developer.android.com/reference/android/...).

The supported way to scroll a ListView widget is: mListView. SmoothScrollToPosition(position); developer.android.com/reference/android/...) However since you mentioned specifically that you would like to offset the view vertically, you must call: mListView. SetSelectionFromTop(position, yOffset); developer.android.com/reference/android/...) Note that you can also use smoothScrollByOffset(yOffset).

However it is only supported on API >= 11 developer.android.com/reference/android/...).

Also, smoothScroolToPosition is only API >= 8 :( – Thomas Ahle Aug 18 at 11:17.

Here is some code from my ListView subclass. It can easily be adapted so it can be used in Activity code. GetListItemsHeight() returns the total pixel height of the list, and fills an array with vertical pixel offsets of each item.

While this information is valid, getListScrollY() returns the current vertical pixel scroll position, and scrollListToY() scrolls the list to pixel position. If the size or the content of the list changes, getListItemsHeight() has to be called again.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions