0

Below code opens numeric Keyboard on some Samsung Devices , Devices include Samsung s7 Edge,A9.

           <EditText
                    android:id="@+id/prdtName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/Product"
                    android:text="@={product.productName}"
                    android:singleLine="true"
                    android:background="@drawable/edittext"
                    android:padding="15dp"
                    android:layout_margin="10dp"
                    bind:font="@{AppConstants.OpenSansRegular}"
                    android:inputType="textCapWords"
                    />

enter image description here

Palash
  • 41
  • 1
  • 2

1 Answers1

0

can you please add the android verion of the devices you tested on?

As I understand, you want to open keyboard and allow the user to enter just capital letters. There is multiple ways to do it :

android:inputType="textCapSentences" will work for sentences to request capitalization of the first character of every sentence.

android:inputType="textCapCharacters" to request capitalization of all characters.

android:inputType="textCapWords"to request capitalization of the first character of every word. These can be combined with text and its variations like textPersonName , textPostalAddress, textShortMessage and more...

for example : android:inputType="textCapWords|textCapSentences" and android:inputType="textPostalAddress|textCapSentences"

check the documentation : https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType

Or you might do it programatically :

EditText input = (EditText).findViewById(R.id.ID);
input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

You can also use android:capitalize, it works on some cases and should automatically capitalize what the user types.

android:inputType="none", which won't automatically capitalize anything.

android:inputType="sentences", Which will capitalize the first word of each sentence.

android:inputType="words", Which Will Capitalize The First Letter Of Every Word.

android:inputType="characters", WHICH WILL CAPITALIZE EVERY CHARACTER.

If all these suggestions doesn't work for you, it's a problem with samsung devices and with some specific android versions. Try to fix that from keyboard settings like suggested here: https://stackoverflow.com/a/31699306/12802591

choubari
  • 41
  • 7