How To Scroll Listview To Specific Position In Android Programmatically
I try to make listview to scroll to position , i have tried all possible functions but all not work for more explanation of code firstly : i put markers on map then call list adapt
Solution 1:
Try this:
listview_nearby_locations.setSelection(9);
Solution 2:
For a direct scroll:
getListView().setSelection(21);
For a smooth scroll:
getListView().smoothScrollToPosition(21);
Taken from here: Programmatically scroll to a specific position in an Android ListView
Solution 3:
thanks guys i used this
Runnablerunnable=newRunnable() {
@Overridepublicvoidrun() {
// TODO Auto-generated method stubif(selected_marker_position != -1){
listview_nearby_locations.setSelection(selected_marker_position);
}
}
};
runnable.run();
Solution 4:
Use the following code..
context.yourListView.smoothScrollToPosition(10);
Post a Comment for "How To Scroll Listview To Specific Position In Android Programmatically"