use*_*329 4 android listview android-listview
我使用实现SectionIndexer的自定义适配器执行ListView.当我在Manifest文件中只键入minSdkVersion = 8时,一切正常.但是如果我将targetSdkVersion = 11(或更多)添加到Manifest,当我滚动列表时,快速滚动条开始滚出屏幕,但是没有列表的结尾.
还有一点:如果我在没有实现SectionIndexer的情况下将manifestSdkVersion = 11添加到清单并执行列表适配器,滚动条也能正常工作.
但我需要targetSdkVersion = 11或更多,并需要SectionIndexer实现.
有任何想法吗?
ePe*_*ace 15
我的猜测是因为你没有正确实现getSectionForPosition(int position)方法.
这是我做的:
@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;
}
Run Code Online (Sandbox Code Playgroud)