user1603329
user1603329

Reputation: 43

FastScrollBar go out of screen, when SectionIndexer implemented

I do ListView with custom adapter which implement SectionIndexer. When I type only minSdkVersion = 8 in Manifest file, all works fine. But if I add targetSdkVersion = 11 (or more) to Manifest, fast scrollbar starts roll out of screen when I scrolling the list, but there is not the end of the list.

And one more moment: if I add targetSdkVersion = 11 to manifest and do list adapter without SectionIndexer implementing, scrollbar works fine too.

But i need targetSdkVersion = 11 or more, and need SectionIndexer implement.

Any ideas?

Upvotes: 4

Views: 725

Answers (1)

ePeace
ePeace

Reputation: 1997

My guess is it's because you didn't correctly implement getSectionForPosition(int position) method.

This is whet I do:

    @Override
    public int getSectionForPosition(int position) {
        for(int i = sections.length - 1; i >= 0; i--) {
            if(position > alphaIndexer.get(sections[i]))
                return i;
        }
        return 0;
    }

Upvotes: 15

Related Questions