如何在 Jetpack compose 中删除 TextField 底线

问题描述 投票:0回答:1

这是我的代码:

TextField(
        value = text,
        onValueChange = { onValueChanged(it) },
        modifier = Modifier
            .fillMaxWidth()
            .height(100.dp)
            .padding(10.dp)
            .border(width = 1.dp, color = Color.Gray, shape = RoundedCornerShape(8.dp)),
        singleLine = false,
        placeholder = { Text("Enter some text here") }
    )

它工作得很好,但我在边界区域之外得到了底线。怎么去掉这条线?

android android-jetpack-compose textfield
1个回答
0
投票

请尝试将背景颜色更改为透明或与您的背景相匹配的颜色。如果有帮助请告诉我

TextField(
    value = text,
    onValueChange = { onValueChanged(it) },
    modifier = Modifier
        .fillMaxWidth()
        .height(100.dp)
        .padding(10.dp)
        .border(
            width = 1.dp,
            color = Color.Gray,
            shape = RoundedCornerShape(8.dp)
        )
        .background(Color.Transparent), <- Set background color to transparent / Color. White
    singleLine = false,
    placeholder = { Text("Enter some text here") }
)
© www.soinside.com 2019 - 2024. All rights reserved.