Closed PetrDana closed 8 years ago
Same here.
Clear query button (right X button) only appear the first time I click and type. If search field lost focus and I click it back, clear button is not there anymore and never come back again.
How to reproduce:
Bonus: should the clear button hide the suggestion list when clicked? Currently it keeps the suggestion list opened. Maybe a flag to set that?
Try doing this when the searchView gains focus:
mSearchView.setOnFocusChangeListener(new FloatingSearchView.OnFocusChangeListener() {
@Override
public void onFocus() {
mSearchView.clearQuery();
mSearchView.setSearchText(""); //your text here
}
@Override
public void onFocusCleared() {
//some other magic
}
});
@fabriciointerama regarding the bonus you mentioned, you can make use of the onSearchTextChanged
listener to implement logic that will do that.
Hi, when i focus first and start writing, clear button is displayed. After lost focus (onFocusCleared) I call setSearchText method for keep query string. After second raising focus and writing, clear button is not displayed. I guess it's just that mClearButton member visibility is set to View.GONE in setSearchFocusedInternal(), but in setupQueryBar() and onTextChanged() is View.INVISIBLE used.
Please check this and fix, thank you.
And one more request - show clear button after FloatingSearchView get focus if mSearchInput is not empty, thanks.