FastScrollBar go out of screen, when SectionIndexer implemented

。_饼干妹妹 提交于 2019-12-10 17:35:50

问题


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?


回答1:


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;
    }


来源:https://stackoverflow.com/questions/11988886/fastscrollbar-go-out-of-screen-when-sectionindexer-implemented

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!