如何使用 DropdownMenu 可组合禁用文本字段中的直接输入?
How to disable direct input in Textfield with DropdownMenu composable?
将 DropdownMenu
与 Textfield
组合使用时,如何防止用户直接输入 Textfield
?
将字段的 enabled
参数设置为 false
可完全停用不需要的字段。
TextField有一个参数叫readOnly
,你可以将它设置为true来防止它被修改。
readOnly controls the editable state of the TextField. When true, the text
field can not be modified, however, a user can focus it and copy text
from it. Read-only text fields are usually used to display pre-filled
forms that user can not edit
将 DropdownMenu
与 Textfield
组合使用时,如何防止用户直接输入 Textfield
?
将字段的 enabled
参数设置为 false
可完全停用不需要的字段。
TextField有一个参数叫readOnly
,你可以将它设置为true来防止它被修改。
readOnly controls the editable state of the TextField. When true, the text field can not be modified, however, a user can focus it and copy text from it. Read-only text fields are usually used to display pre-filled forms that user can not edit