android - Jetpack Compose 中带有提示文本的 TextField

标签 android android-textinputlayout android-jetpack-compose android-compose-textfield

我想在 jetpackcompose 中创建带有 hint 文本的 textfield。任何示例如何使用 jectpack 创建 textfield?谢谢

最佳答案

compose_version = '1.0.0-beta07'

使用参数placeholder显示提示

TextField(value = "", onValueChange = {}, placeholder = { Text("Enter Email") })

使用参数label显示 float 标签

TextField(value = "", onValueChange = {}, label = { Text("Enter Email") })

关于android - Jetpack Compose 中带有提示文本的 TextField,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58883218/

相关文章:

android - 创建长期运行的服务

android - Android 的 PrintedPdfDocument 中的函数 getContentView() 是什么

java - 同步 Android todolist 与谷歌日历

android - LazyColumn - 项目关键参数用途?

android - 谷歌语音识别源代码

android - 在 Android 平板电脑版本 4.4.2 中扩展类 EditText 时出错

android - 添加的 EditText 不是 TextInputEditText。请改用该类(class)

android - 预览自定义 TextInputLayout 时出现问题

android - 为什么有时需要在列表中使用 key() ?

android - 如何设置 JetpackCompose 按钮​​背景颜色