I'm looking for a method to be fired when a programmatically scrolling (by using smoothscrolltoposition) has reached the given position.
I have an activity, with a listview. When the user taps a button, the list scrolls to a given position. I need to change the item layout properties of that position.
I'm using a scroll listener, and overriding the onScroll method to do this, but the method is not executed at the end as the documentation says.
BTW: I'm using API 8.
Here my code:
public void scrollToPosition(View view) {
this.myList.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
// Here I need to be positioned in the right place, to change the row layout.
MyActivity.this.myList.setOnScrollListener(null);
}
});
this.myList.smoothScrollToPosition(this.position - 1);
}
TIA,
Milton.