I have implemented Section Indexer for an Adapter class which extends BaseAdapter. Now for the first launch Section Indexer is showing an overlay correctly. But when the contents of the list gets updated the Section Overlay does not get updated and gives ArrayOutOfBoundException. For one fix what i did is i made listview.setFastScrollEnabled(false); update the adapter contents; and then listview.setFastScrollEnabled(true); Now what happens is overlay gets updated but the Overlay is coming to the left top of the listview. How can I fix this.
Thought I'd share a ready-made version of the above workaround for a ListActivity:
private boolean FLAG_THUMB_PLUS = false;
private void jiggleWidth() {
ListView view = getListView();
if (view.getWidth() <= 0)
return;
int newWidth = FLAG_THUMB_PLUS ? view.getWidth() - 1 : view.getWidth() + 1;
ViewGroup.LayoutParams params = view.getLayoutParams();
params.width = newWidth;
view.setLayoutParams( params );
FLAG_THUMB_PLUS = !FLAG_THUMB_PLUS;
}
Works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With