我想限制用户可以在 Jetpack Compose 的 TextField 中输入的内容。我怎么做?
xml 中的等价物是 inputType
:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:hint="Only numbers please!" />
最佳答案
使用KeyboardOptions :
TextField(
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
关于android - 如何在 Jetpack Compose 中为 TextField 设置 inputType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66482473/