如何在行上添加 TextField?
How add TextField on Row?
我无法在行中添加文本字段。我已经尝试过使用 row、flexrow、flowrow、stack、wrap 和 container。在专栏上有效。
java.lang.IllegalArgumentException: minWidth 2147483647.ipx should be finite
at androidx.ui.core.Constraints.<init>(Constraints.kt:48)
at androidx.ui.core.Constraints$Companion.tightConstraintsForWidth(Constraints.kt:72)
at...
我要这样输出;
Username: (TEXTFIELD)
试试下面的代码
MaterialTheme {
val state = +state { " " }
Padding(left = 16.dp, right = 16.dp) {
FlexRow(
crossAxisAlignment = CrossAxisAlignment.Center
) {
inflexible {
Container() {
Text{
Span(
text = "Username: ",
style = TextStyle(
color = Color(0xFFFF0000),
fontSize = 18.sp,
fontWeight = FontWeight.W200,
fontStyle = FontStyle.Normal
)
)
}
}
}
expanded(1f) {
TextField(value = state.value, onValueChange = { state.value = it })
}
}
}
}
输出:
我无法在行中添加文本字段。我已经尝试过使用 row、flexrow、flowrow、stack、wrap 和 container。在专栏上有效。
java.lang.IllegalArgumentException: minWidth 2147483647.ipx should be finite
at androidx.ui.core.Constraints.<init>(Constraints.kt:48)
at androidx.ui.core.Constraints$Companion.tightConstraintsForWidth(Constraints.kt:72)
at...
我要这样输出;
Username: (TEXTFIELD)
试试下面的代码
MaterialTheme {
val state = +state { " " }
Padding(left = 16.dp, right = 16.dp) {
FlexRow(
crossAxisAlignment = CrossAxisAlignment.Center
) {
inflexible {
Container() {
Text{
Span(
text = "Username: ",
style = TextStyle(
color = Color(0xFFFF0000),
fontSize = 18.sp,
fontWeight = FontWeight.W200,
fontStyle = FontStyle.Normal
)
)
}
}
}
expanded(1f) {
TextField(value = state.value, onValueChange = { state.value = it })
}
}
}
}
输出: