In Android EditText, how to force writing uppercase?
问题 In my Android application I have different EditText where the user can enter information. But I need to force user to write in uppercase letters. Do you know a function to do that? 回答1: Android actually has a built-in InputFilter just for this! edittext.setFilters(new InputFilter[] {new InputFilter.AllCaps()}); Be careful, setFilters will reset all other attributes which were set via XML (i.e. maxLines , inputType , imeOptinos ...). To prevent this, add you Filter(s) to the already existing