Scroll Position of div with “overflow: auto”
You need to use the scrollTop property. document.getElementById(‘box’).scrollTop
You need to use the scrollTop property. document.getElementById(‘box’).scrollTop
Try this: // save index and top position int index = mList.getFirstVisiblePosition(); View v = mList.getChildAt(0); int top = (v == null) ? 0 : (v.getTop() – mList.getPaddingTop()); // … // restore index and position mList.setSelectionFromTop(index, top); Explanation: ListView.getFirstVisiblePosition() returns the top visible list item. But this item may be partially scrolled out of view, … Read more