0

i have created listview as follows...

lv = (ListView) findViewById(R.id.listview);
    lv.setAdapter(new ArrayAdapter<String>(this,
            android.R.layout.simple_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

enter image description here

i DONT want it to be as follows:

enter image description here

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 :)

kAnNaN
  • 3,669
  • 4
  • 28
  • 39

2 Answers2

1

following link might help you Android search list while typing

Community
  • 1
  • 1
ingsaurabh
  • 15,249
  • 7
  • 52
  • 81
1

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)

sat
  • 40,138
  • 28
  • 93
  • 102