2012-09-18 30 views
0

我试图用字母顺序创建一个快速滚动。有人可以告诉我如何在另一个班级中使用the code in this question?我有一个返回信我需要把在快速滚动的方法的类,所以我想使用这个类在一个又一个,像这样:按字母顺序排列的FastScroll

MyListAdaptor mla = new MyListAdaptor(getApplicationContext(), itemsBP); 
mla.xyz(); 

但我不知道我怎么能使字母出现。

如果可以,请帮助我。

+0

添加您的适配器代码。 –

+0

我给他一个我想要的参数列表(itemsBP),这个操作有什么缺失吗?我没有adpter ......实际上我的困难在于了解创建FastScroll所需的步骤。 如果可以的话,请帮助我。 谢谢, Soraia Oliveira – Soraia

+0

那么你复制他的适配器来测试FastScroll? –

回答

0

在一些研究结束时,我意识到,少了什么是下面的代码,它必须被放置在OnCreate中():

LinkedList <String> mLinked <String> = new LinkedList(); 
for (int i = 0; i <nomes.length: i + +) { 
mLinked.add (names [i]); 
} 

setListAdapter (new MyListAdaptor (this, mLinked)); 

ListView lv = getListView(); 
lv.setFastScrollEnabled (true); 

lv.setOnItemClickListener (new OnItemClickListener() { 
public void onItemClick (AdapterView <?> parent, View view, 
int position, long id) { 
// When clicked, show a toast with the TextView text 


Toast.makeText (getApplicationContext(), ((TextView) view). GetText(). ToString(), Toast.LENGTH_SHORT.) Show(); 
} 
}); 

而且把类代码的类MyListAdaptor主要的OnCreate中() 。

感谢您的帮助,并希望这可以帮助其他人在未来。