How to make EditText not editable but scrollable

EditText not Editable but Scrollable

When we need to show long text like Terms and conditions in EditText. We need to allow scrolling and it should not be editable.

Editable

For this I tried in XML set EditText attributes to show vertical scrollbars

android:scrollbars="vertical"

And then to make EditText not editable i tried different ways like

android:inputType="none"

not worked, and also tried

android:Editable=false

but it is deprecated.

And then tried this line in code

editTextView.setEnabled(false);

Its not allowed to Edit. But unable scroll text in EditText.

Solution:

And Finally i found the work around for it. Added this line in code.

editTextView.setKeyListener(null);

It worked perfectly….

Hope this helps somebody….

You may be also interested in

 

Leave a Reply

Your email address will not be published. Required fields are marked *