I want to set a value in textField and not being able to change this value, only possible to insert new values. (kotlin)

Viewed 32

I have a registration form, when I select an especific option on input, a textField this form receive a value that cannot be changed, being able to only type with other values ​​in this textField.

1 Answers

If you want to have a text field only the app can update (and the user can't type into), use a TextView.

If you want them to be able to type into it, but you want to be able to set a value and "lock" it so they can't edit it anymore, you can use an EditText and do enabled = false. That also greys out the field - if you don't want that, you can do inputType = EditorInfo.TYPE_NULL to prevent the keyboard from appearing.

If you want a fixed set of options that the user can choose from, you can use an AutoCompleteTextView or the Material Components equivalent

Related