When sectionindexer is implemented, Android – fastscrollbar goes out of the screen

I use a custom adapter that implements sectionindexer to execute listview. When I only type minsdkversion = 8 in the manifest file, everything is normal. However, if I add targetsdkversion = 11 (or more) to the manifest, when I scroll the list, the quick scroll bar starts to roll out of the screen, but there is no end of the list

One more thing: if I add manifestsdkversion = 11 to the list and execute the list adapter without implementing the sectionindexer, the scroll bar will also work properly

But I need targetsdkversion = 11 or more, and I need the sectionindexer implementation

Any ideas?

resolvent:

My guess is that you don't implement the getsectionforposition (int position) method correctly

This is what 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;
    }

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>