MaterialSearchBar
MaterialSearchBar copied to clipboard
Controlling clear button
this is an amazing searchview with multi-functionalities, but there is missing an option for controlling CLEAR button. i've changed .setClearIcon()
to search icon but i am unable to control this function.
what i want is, when user type more than 3 keywords CLEAR icon should be changed into SEARCH icon and it should be controllable through onButtonClicked()
method of setOnSearchActionListener()
, so that's why i changed only icon through onTextChanged()
.
when you call onSearchActionListener you control all buttons in this section.
@Override public void onButtonClicked(int buttonCode) { if(buttonCode == MaterialSearchBar.BUTTON_NAVIGATION) { //opening or closing navigation drawer } else if ( buttonCode == MaterialSearchBar.BUTTON_BACK) { materialSearchBar.disableSearch(); } }