Cursor position SearchView Android

0

I am looking for a way to position the cursor of a SearchView at the beginning of the text. What I do is that I rescue a text and place it in the SearchView and the cursor is positioned at the end of it.

I know that in EditText there is the setSelection (), but I can not find a similar method in SearchView.

Is there any way to do it?

I await your response, Thank you

    
asked by Felipe J. Ramirez 15.12.2018 в 20:45
source

1 answer

0

The SearchView contains an EditText in which you should be able to move the cursor with the setSelection (). to access the EditText you can do something like this:

EditText searchText = (EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
    
answered by 17.12.2018 / 12:58
source