Answer the question
In order to leave comments, you need to log in
Remove icon from SearchView?
Do not tell me how to remove the search icon on the left when android.support.v7.widget.SearchView is active.
<item
android:id="@+id/action_search"
android:title="@android:string/search_go"
app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView" />
private void initToolBar() {
toolbar = (Toolbar) findViewById(R.id.toolbarSearch);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.mipmap.ic_arrow_back_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//toolbar.inflateMenu(R.menu.search_menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.search_menu, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.clearFocus();
searchView.setIconifiedByDefault(false);
return true;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question