Is there any way to achieve like below image? I have an EditText and i want InputType is always Caps. I tried using this
android:inputType="textCapCharacters"
its working fine but when i press top Arrow icon from softkeyboard(shown in below image) and start typing text will be in small character. Is there any way to Disable the top arrow key?
Thanks

You can do it through code as follow:
Applying UpperCase as the only filter to an EditText
Here we are setting the UpperCase filter as the only filter of the EditText. Notice that doing it this way you are removing all the previously added filters(maxLength, maxLines,etc).
editText.setFilters(new InputFilter[] {new InputFilter.AllCaps()});
Adding UpperCase to the existing filters of an EditText
To keep the already applied filters of the EditText (let's say maxLines, maxLength, etc) you need to retrieve the applied filters, add the UpperCase filter to those filters, and set them back to the EditText. Here is an example how:
InputFilter[] editFilters = editText.getFilters();
InputFilter[] newFilters = new InputFilter[editFilters.length + 1];
System.arraycopy(editFilters, 0, newFilters, 0, editFilters.length);
newFilters[editFilters.length] = new InputFilter.AllCaps();
editText.setFilters(newFilters);
It works for me, Try this
edittext.setInputType(InputType.TYPE_CLASS_TEXT);
edittext.setFilters(new InputFilter[]{new InputFilter.AllCaps()});
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