FastScrollBar走出屏幕,当SectionIndexer实施 [英] FastScrollBar go out of screen, when SectionIndexer implemented

查看:212
本文介绍了FastScrollBar走出屏幕,当SectionIndexer实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做的与实现SectionIndexer自定义适配器的ListView。当我在清单文件仅键入的minSdkVersion = 8,一切工作正常。但是,如果我添加targetSdkVersion = 11(或更多)的体现,快速滚动开始推出屏幕,当我滚动列表,但没有列表的末尾。

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.

和多了一个时刻:如果我添加targetSdkVersion = 11来体现和待办事项适配器没有SectionIndexer实施,滚动条正常工作太

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

但我需要targetSdkVersion = 11以上,并且需要SectionIndexer实施。

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

任何想法?

推荐答案

我的猜测是,那是因为你没有正确地实现getSectionForPosition(INT位置)的方法。

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

这是激起我做的:

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

这篇关于FastScrollBar走出屏幕,当SectionIndexer实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆