4

I want the editText box to be click-able so the user can scroll through the text, but I do not want the keyboard to appear. I have tried all these but they do not do what I want:

In XML:

android:editable="false"
android:windowSoftInputMode="stateAlwaysHidden"
android:inputType="none"

This disables it:

editText.setInputType(EditorInfo.TYPE_NULL); 

This only works on API 21 and above:

editText.setShowSoftInputOnFocus(false);
james
  • 47
  • 6

3 Answers3

2

Try this

<EditText
        android:id="@+id/et_file_url"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="none"
        android:lines="1"
        android:textIsSelectable="true" />
Ahmed Hegazy
  • 11,465
  • 5
  • 35
  • 62
1

Use these lines of code

  EditText editText= (EditText) findViewById(R.id.editText);
  InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
Ravindra Kushwaha
  • 6,734
  • 9
  • 42
  • 85
0

Set an edit text on touch listener. This will make the edit text untouchable because it is set to return true.

   EditTextHere.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
          return true;
        }
    });

Make a statement that it will allow the user to touch edit text by returning it to false.