我无法在行上添加文本字段。我已经尝试过使用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...
我要这样输出;
用户名:(TEXTFIELD)
答案 0 :(得分:4)
尝试下面的代码
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 })
}
}
}
}
输出: