开发者

android searching the list view?

i have created listview as follows...

lv = (ListView) findViewById(R.id.listview);
    lv.setAdapter(new ArrayAdapter<String>(this,
            android.R.layout.si开发者_如何学Pythonmple_list_item_checked, mDisplay));

my question is that i need to make the listview searchable such that if the user enters an alphabet the listview must scroll to that item starting with that alphabet (i dont want it to be filtered) with all the list items visible ...

for example if the user press "f" i want the list to scroll to the 1st item with "f" as follows

android searching the list view?

i DONT want it to be as follows:

android searching the list view?

i am sorry if the question is not understandable because i dont know how to put it

ask me if u need more details...

thanks :)


following link might help you Android search list while typing


I don't know if something for your requirement in readly available. But you can implement it through a logic like this.

Whenever user presses say f, check in your arraylist from which position words from f starts. say from 5th position it starts.

and use

listview.smoothScrollToPosition(int position)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜