我正試圖創建一個自定義的搜索欄;其中我使用Row()可作為所有其他元素的一個容器。在這里,最后一個FloatingActionButton被擠壓,但我希望TextField是靈活的,以便它被縮短以適應其余元素。
我已經知道一些變通方法,但我想要一個更好的解決方案。請看下面已知的變通方法和它們的缺點。
。
@Preview(showBackground = true, widthDp = 410)
@Composable
fun MyComposable() {
Row(Modifier.fillMaxWidth()) {
TextField(value = "Search", onValueChange = {})
FloatingActionButton(onClick = {}) {Icon(Icons.Filled.SkipNext, contentDescription = null)}。
FloatingActionButton(onClick = {}) {Icon(Icons.Filled.Close, contentDescription = null)}。
FloatingActionButton(onClick = {}) {Icon(Icons.Filled.Home, contentDescription = null)}
}
已知的變通方法:
ConstraintLayout(缺點:復雜。 在許多情況下似乎是矯枉過正。)
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/311863.html
標籤:

