Scroll A Particular Listview Item Into View
In my application, I have a ListView. The data for each item in the list is an instance of the SomeItem class. The list has a custom ArrayAdapter which has a custom view to display
Solution 1:
You can try the following:
Calculate the position of the
SomeItem
item you want to make visible. You can do this by iterating over the list ofSomeItem
s that you pass to the adapter.Use
listView.getFirstVisiblePosition()
,listView.getLastVisiblePosition()
and the calculated position to check if the item is visible on the list.If the item is not visible, make
listView
scroll to it by callinglistView.smoothScrollToPosition(calculatedPosition)
.
Post a Comment for "Scroll A Particular Listview Item Into View"