Answer the question
In order to leave comments, you need to log in
EditText without virtual keyboard?
I would like to use the EditText component and all of its methods without using the virtual keyboard. In other words, when a field is clicked (focused), I don't want the virtual keyboard to pop up. At the same time, I need the cursor to work, text selection, scrolling, etc.
Before the 3rd version of android, this problem was solved by me by overriding the TextView#onCheckIsTextEditor() method and returning false. But starting from the 3rd version, the behavior of the TextView has changed, namely, checking the state of the cursor (its visibility) also began to check the TextView#onCheckIsTextEditor() property (the TextView#isCursorVisible() method began calling the TextView#onCheckIsTextEditor() method) and, as a result, the cursor disappeared . The rest of the component's behavior has not changed.
A quick and very “dirty” solution is to check the stack trace and return a different value when calling the code from different methods (if called from under TextView#isCursorVisible(), return true, otherwise false). Problematic code here
1. Are there other normal (and preferably simple) ways to solve this problem?
2. Is it normal behavior on the part of android developers to change the behavior of basic components?
Answer the question
In order to leave comments, you need to log in
To just not show the keyboard you need to do
editText.setInputType(InputType.TYPE_NULL);
public boolean getDefaultEditable() {
return false;
}
or in xml add to the description of the EditText elementandroid:editable="false"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question