[英]custom textfield jetpack compose, I do not know how to do with Textfield
由於您需要一個不遵循 Material Design 的自定義TextField
,因此您應該使用BasicTextField
並根據需要對其進行自定義(您需要為此檢查參數)。
這只是您實施的起點......
@Composable
fun CustomTextField() {
var text by remember {
mutableStateOf("")
}
Card(Modifier.fillMaxWidth()) {
Row(
Modifier
.height(IntrinsicSize.Min)
) {
Icon(
imageVector = Icons.Default.Search,
contentDescription = null,
modifier = Modifier.padding(8.dp)
)
BasicTextField(
value = text,
onValueChange = { text = it },
Modifier
.weight(1f)
.padding(8.dp)
)
Box(
Modifier
.padding(vertical = 2.dp)
.width(1.dp)
.fillMaxHeight()
.background(MaterialTheme.colors.onBackground.copy(alpha = .5f))
)
Icon(
imageVector = Icons.Default.Settings,
contentDescription = null,
modifier = Modifier.padding(8.dp)
)
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.