简体   繁体   中英

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

我有一个注册表单,当我在输入时选择一个特定的选项时,这个表单的一个 textField 会收到一个无法更改的值,只能在这个 textField 中输入其他值。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM