问题
I have an edit text field. When the user clicks on it by default it shows small letters on the virtual keyboard.
I want by default to display first letter caps and rest of them small on the keyboard.
How can this be done?
回答1:
Try adding android:capitalize="sentences"
to the definition of the EditText
in your Layout
file. This should capitalize
the first character of the sentence. If you want to begin each word with a capital letter use words.
More about this can be found in the API.
回答2:
android:capitalize
is deprecated. So please use: android:inputType
android:inputType="textCapSentences"
回答3:
In order to captialize every character of EditText use these property.
android:capitalize="characters"
回答4:
I used below attribute with textCapCharacters
value in my EditText
to turn on caps lock on the virtual keypad and it worked.
android:inputType="textCapCharacters"
回答5:
To capitalize all characters of Keyboard use this in your edittext
in xml:
android:inputType="textCapCharacters"
To capitalize of the first character of every sentence use this :
android:inputType="textCapSentences"
来源:https://stackoverflow.com/questions/2847221/android-virtual-keyboard-turn-on-caps-lock