0

I need the keyboard to be shown in the mode similar to the password input type field, but i dont want to specifically set it to that mode for all the Edittext's in the xml. My required type is somewhat similar to the image here: Sample Keyboard Pattern Basically, I want to disable the whole bar that contains the speech and auto complete in it, but want my EditText to display the same mode as normal text field.

Sarvesh
  • 17
  • 9

2 Answers2

1

Add the following attributes to your EditText layout:

android:inputType="textFilter"
android:privateImeOptions="nm"

Additionally, add this in onCreate method of MainActivity:

InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);

For reference, take a look at this.

Yash Mittal
  • 97
  • 1
  • 12
0

You could try this on the xml:

android:inputType="textFilter|textNoSuggestions"

or

android:inputType="textFilter"

or if the code above causes error, try this on your code:

txtEditText = (EditText) findViewById(R.id.txtEditText);
txtEditText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

Hope this helps! Goodluck!