I wanna when listview 1 is scrolled by user, listview 2 also is scroll like listview 1 (exactly in pixel).
I tried to scroll listview 2 by smoothScrollByOffset(offset),
but it scrolls more than listview 1.
I dont know why?
What happened with smoothScrollByOffset(offset) or I miss something?
Further information:
Code to scroll listview 2 (in onScroll callback of listview 1):
int previsous = 0;
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
//get current position in pixel of listview 1
View c = lv1.getChildAt(0);
int scrolly = -c.getTop() + lv1.getFirstVisiblePosition() * c.getHeight();
//Difference in pixel with the last scroll
int delta = scrolly - previsous;
Log.d("scroll", "listview 1 has scrolled: " +
scrolly + "| Difference with the last " + delta);
//scroll listview 2 by delta
lv2.smoothScrollByOffset(delta);
previsous = scrolly;
}
Screen shot for diagnostic: