@Composable
fun SimpleFilledTextFieldSample() {
var text by remember { mutableStateOf("Hello") }
TextField(
modifier = Modifier
// .fillMaxWidth()
.padding(16.dp)
// .border(1.dp, Color.Transparent) // 设置边框
.background(Color.Transparent), // 设置背景颜色
textStyle = LocalTextStyle.current.copy(
fontSize = 18.sp, // 设置文字大小
color = Color.Black // 设置文字颜色
),
colors = TextFieldDefaults.colors(
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent ,
),
shape = RoundedCornerShape(4.dp), // 设置圆角
singleLine = true,
value = text,
onValueChange = { text = it },
placeholder = {
Text(text = "Enter your text here") // 设置占位符文本
},
)
}
11-02
1796
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-08
2099
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-27
3105
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-25
1480
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-28