Reputation: 1821
I'm using ListView
to display my dynamic content. Based on selected option, I've to scroll to some specified position in ListView
. This works great when the list item height is not that big, i.e. it covers the whole screen. But when big height item are present in list, the scroll doesn't take me to proper position, instead it takes to some in between position. I tried using both of the following but same result.
listView.smoothScrollToPosition(myItems.indexOf(thisItem));
listView.setSelection(myItems().indexOf(thisItem));
Can anybody point the possible cause of the issue and also give some suggestions.
Upvotes: 2
Views: 538
Reputation: 1821
The workaround suggested here worked for me except that I called both functions, smoothScrollToPosition
and setSelection
, sequentially instead of using OnScrollListener
. Though its not giving smooth scrolling effect but it's fulfilling my requirement. If any body can suggest a more proper solution, it's welcomed.
Upvotes: 1