Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Is it possible to make edittext uneditable in android?


Asked by Dominik Herman on Nov 29, 2021 Android



You should be able to make the EditText editable/uneditable when you want. Using this: How to make EditText not editable through XML in Android? You said that you wanted your field to be editable after some logic.
Moreover,
If you have a requirement wherein you want to make Android EditText not editable (un-editable or disabled) that you need to add certain attributes to the EditText tag as android:editable is been deprecated. Defines whether this view reacts to click events. It controls whether a view can take focus.
Thereof, To use this just set android:inputType="none" and it will become non editable. In your xml code set focusable="false", android:clickable="false" and android:cursorVisible="false" and this will make your EditText treat like non editable. If you can also disable EditText, then you can set this from Java or Kotlin code.
Consequently,
Editable. This is the interface for text whose content and markup can be changed (as opposed to immutable text like Strings). If you make a DynamicLayout of an Editable, the layout will be reflowed as the text is changed.
Indeed,
A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities. Following are the important attributes related to EditText control.