我需要一个ListView Indexable
,当我点击
某个数字时,它会将我重定向到索引的
与 行
row
的 ListView Indexable
的数量相同。例如,当我点击
2 时,它会将我重定向到index
(ListView
) 编号的行
是 2 。
最佳答案
试试这个方法,希望能帮助您解决问题。
如果您不想更改 IndexScroller 类中的任何代码,请更改 SimpleAdapter 类中的以下代码。
右侧部分值作为列表中没有项目。
private String[] mSections;
public SimpleAdapter(ArrayList<String> mCurrentList, Context mContext) {
super();
this.mCurrentList = mCurrentList;
mSections = new String[mCurrentList.size()];
for(int i=0;i<mCurrentList.size();i++){
mSections[i] = String.valueOf(i+1);
}
this.mContext = mContext;
}
尝试给定选定的右侧部分值来移动列表。
@Override
public int getPositionForSection(int section) {
return section;
}
关于android - ListView 可索引吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26646659/