Can we limit the number of character in edittext of SearchView in Android?
问题 Is there any api to set the limit no. of characters in SearchView ? 回答1: I am using following code snippet: TextView et = (TextView) searchView.findViewById(R.id.search_src_text); et.setFilters(new InputFilter[]{new InputFilter.LengthFilter(10)}); 回答2: Use this code it will do search only if length is less or equal to 5.You can make it change accordingly like returning true from onQueryTextChange() when text>5. final SearchView searchView = (SearchView) mSearchMenuItem.getActionView();