My activity has an EditText
which is supposedly not editable until user clicks on edit button for the screen.
I did edit.setEnabled(false)
but still a keyboard appears for the user and values can be added to the EditText
in the screen via the keyboard even though the screen might look a bit greyed out. What else do I have to do to prevent editing of the EditText
until user has specifically pushed an edit button.
Thanks, Steve
This example demonstrates how do I hide soft keyboard on android after clicking outside edittext. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
Attention that setEditable
is depecrated.
You can use :
setInputType(EditorInfo.TYPE_CLASS_TEXT)
To turn keyboard on.
setInputType(EditorInfo.TYPE_NULL)
To turn keyboard off.
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