I need to force user to write in uppercase letters in searchview v7 Do you know a way to do that? similar to that used in editText:
filter_text.setFilters(new InputFilter[]{new InputFilter.AllCaps()});
In code you can do so by adding the following.
searchView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);
All of the other things you can add can be found here
Edit:
Actually a better way is to do
searchView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
Alternatively, you can also set the android:inputType
to textCapWords
inside searchable.xml
that you will create if you followed the official SearchView
setup guide.
https://developer.android.com/training/search/setup.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With