I try to make text starts with uppercase first letter. Using attr inputType
<EditText
android:id="@+id/add_user_fname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_size_small"
android:inputType="textCapSentences|textPersonName"
android:capitalize="sentences"
android:layout_toRightOf="@id/user_avatar"
android:hint="@string/add_user_fname"
android:maxLength="@integer/name_max_length"
android:singleLine="true"
android:textSize="@dimen/text_size_small" />
and set in code
userFnameEditText.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
but nothing works. All of this places in DialogFragment.
Updated I removed setInputType in code and set only inputType="textCapSentences". It works on Android 4, but doesn't work on Samsung Android 5
I had the same problem. But, I found a solution that help me: Be sure that your "Auto Capitalization" settings is checked on keyboard settings. This works on Nexus 4.
Reference: http://www.ercanbaran.com/textcapsentences-not-working/
Edited Try it in your java file
TextView txtCapitalize = (TextView) findViewById(R.id.txtCapitalize);
txtCapitalize.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
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