SearchView query hint before clicking it

Use this XML:

android:queryHint="hint"
app:queryHint="hint"
app:defaultQueryHint="hint"
android:iconifiedByDefault="false"  // this line
app:iconifiedByDefault="false"

app used for {android.support.v7.widget.SearchView}


You can just add android:iconifiedByDefault="false" it just displays the query hint string by default


You can add these below lines:

SearchView searchView = (SearchView) findViewById(R.id.searchView);
searchView.onActionViewExpanded();
searchView.setIconified(true);

and add this to hiding focus (Keyboard)

 new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                search.clearFocus();
            }
    }, 300);