As mentioned here, Android’s GridView.scrollTo() doesn’t work. The method the solution mentioned, setSelectedPosition, doesn’t seem to exist in GridView
smoothScrollToPosition does work, but I really don’t want the animation.
For context, I have a CursorAdapter-backed GridView, and I want the view to “reset”, i.e. scroll to the top, when I change the cursor.
I’ve been using
setSelection(int position)for this, and it seems to be working just fine. To scroll to the top, just use 0 for position.From the docs:
Edit:
Added code to post
setSelectionas a Runnable: