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.
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
- HTML Tags Supported By TextView, Android
- Apply ColorStateList for TextView
- Show soft keyboard for EditText when Fragment starts
- Validation using default feature of EditText
- EditText, Keyboard is filling the entire screen when Landscape Orientation
One thought on “How to make EditText not editable but scrollable”
Great !
Thank you