So i have this SearchView
inside a sliding drawer menu. The problem is when i tap the SearchView
for the first time, it wont let me type anything, i need to tap on it again the second time before it works. This is the first time i encountered this problem hope anyone will help me. Thanks.
First Tap (not working!):
Second Tap (working) :
And here are my codes :
SearchView search = null;
search = (SearchView) view.findViewById(R.id.searchView1);
search.setIconifiedByDefault(false);
search.setQueryHint("Search Picklrs");
search.setQueryHint(Html.fromHtml("<font color = #b3b3b3>" + "Search Picklrs" + "</font>"));
int id = search.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
search.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
Intent i = new Intent(context, SearchResultsActivity.class);
i.putExtra("STRING_I_NEED", query);
context.startActivity(i);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {return false;}
});
Try this..
Use search.setFocusable(true);
for that SearchView
search = (SearchView) view.findViewById(R.id.searchView1);
search.setFocusable(true);
search.performClick();
search.requestFocus();
search.setIconified(true);